This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ErrorController : Controller | |
{ | |
public ILogger Logger { get; set; } | |
public ActionResult Error(int code = 404, string redirectedUrl = "") | |
{ | |
ViewBag.StateCode = code; | |
if (code == 401) | |
if (!string.IsNullOrEmpty(redirectedUrl)) | |
return Redirect(redirectedUrl); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MvcErrorAttribute : HandleErrorAttribute | |
{ | |
public ILogger Logger { get; set; } | |
public ErrorController ErrorController { get; set; } | |
public MvcErrorAttribute() | |
{ } | |
public override void OnException(ExceptionContext filterContext) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ErrorHandlerModule : Autofac.Module | |
{ | |
protected override void Load(ContainerBuilder builder) | |
{ | |
base.Load(builder); | |
builder.RegisterType<MvcErrorAttribute>() | |
.As<HandleErrorAttribute>() | |
.PropertiesAutowiredWithParameters(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Bootstrapper | |
{ | |
public Bootstrapper() | |
{ } | |
private ContainerBuilder builder; | |
private IContainer container; | |
public IContainer Container | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MvcApplication : HttpApplication | |
{ | |
public MvcApplication() | |
{ } | |
void Application_Error(object sender, EventArgs e) | |
{ | |
var httpContext = ((MvcApplication)sender).Context; | |
var exception = Server.GetLastError(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
public static class AutofacExtensions | |
{ | |
/// <summary> | |
/// Special autowiring mode that also scans Resolve parameters while wiring properties | |
/// </summary> | |
public static IRegistrationBuilder<TLimit, TActivatorData, TRegistrationStyle> PropertiesAutowiredWithParameters<TLimit, TActivatorData, TRegistrationStyle>(this IRegistrationBuilder<TLimit, TActivatorData, TRegistrationStyle> rb) | |
{ | |
AutowiringPropertyInjectorWithParameters injector = new AutowiringPropertyInjectorWithParameters(); | |
rb.RegistrationData.ActivatingHandlers.Add(delegate(object s, ActivatingEventArgs<object> e) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Phone.Controls; | |
using System; | |
using System.Windows; | |
using System.Windows.Controls; | |
using System.Windows.Controls.Primitives; | |
using System.Diagnostics; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace Ocell.Controls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Net.Http; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Windows.Security.Cryptography; | |
using Windows.Security.Cryptography.Core; | |
using Windows.Storage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FileService : IFileService.IFileService | |
{ | |
private readonly string ftpUserName; | |
private readonly string ftpPassword; | |
private readonly string ftpRootPath; | |
public ILogger Logger { get; set; } | |
public FileService(string user, string password, string server) | |
{ | |
this.ftpUserName = user; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try | |
{ | |
string source = "1.png"; | |
WebClient client = new WebClient(); | |
NetworkCredential nc = new NetworkCredential("test", "test"); | |
Uri addy = new Uri(@"\\192.168.57.182\Upload\" + source); | |
client.Credentials = nc; | |
byte[] arrReturn = client.UploadFile(addy, "1.png"); | |
} | |
catch (Exception e) |