c# Programming Glossary: httpcontextbase
How to unit-test an MVC controller action which depends on authentification in c#? http://stackoverflow.com/questions/1106398/how-to-unit-test-an-mvc-controller-action-which-depends-on-authentification-in-c .Returns true or false var context new Mock HttpContextBase context.SetupGet x x.Request .Returns request.Object var controller..
How to produce non-sequential prefix collection indices with MVC HTML Editor templates? http://stackoverflow.com/questions/11267354/how-to-produce-non-sequential-prefix-collection-indices-with-mvc-html-editor-tem htmlFieldPrefix private static Queue string GetIdsToReuse HttpContextBase httpContext string collectionName We need to use the same sequence..
Moq: unit testing a method relying on HttpContext http://stackoverflow.com/questions/1214178/moq-unit-testing-a-method-relying-on-httpcontext method to use dependency injection with an HttpContextBase object. HttpContextWrapper resides in System.Web.Abstractions.. 3.5. It is a wrapper for the HttpContext class and extends HttpContextBase and you can construct an HttpContextWrapper just like this var.. HttpContext.Current Even better you can mock an HttpContextBase and set up your expectations on it using Moq. Including the..
How do I mock the HttpContext in ASP.NET MVC using Moq? http://stackoverflow.com/questions/1452418/how-do-i-mock-the-httpcontext-in-asp-net-mvc-using-moq var context new Mock HttpContextBase var request new Mock HttpRequestBase context .Setup c c.Request..
Detecting Session expiry on ASP.NET MVC http://stackoverflow.com/questions/1490879/detecting-session-expiry-on-asp-net-mvc OnActionExecuting ActionExecutingContext filterContext HttpContextBase ctx filterContext.HttpContext check if session is supported..
ASP.NET MVC Authorization http://stackoverflow.com/questions/329658/asp-net-mvc-authorization AuthorizeAttribute protected override bool AuthorizeCore HttpContextBase httpContext string users Users.Split ' ' if httpContext.User.Identity.IsAuthenticated..
ASP.NET mvc, localized routes and the default language for the user http://stackoverflow.com/questions/3683404/asp-net-mvc-localized-routes-and-the-default-language-for-the-user values private string _values public bool Match HttpContextBase httpContext Route route string parameterName RouteValueDictionary..
Mock HttpContext.Current in Test Init Method http://stackoverflow.com/questions/4379450/mock-httpcontext-current-in-test-init-method public static class FakeControllerContext public static HttpContextBase FakeHttpContext string username var context new Mock HttpContextBase.. FakeHttpContext string username var context new Mock HttpContextBase context.SetupGet ctx ctx.Request.IsAuthenticated .Returns string.IsNullOrEmpty.. of System.Web.HttpContext which does not extend System.Web.HttpContextBase . HttpContextBase was added later to address HttpContext being..
When `PostAuthenticateRequest` gets execute? http://stackoverflow.com/questions/5947278/when-postauthenticaterequest-gets-execute AuthorizeAttribute protected override bool AuthorizeCore HttpContextBase httpContext var isAuthorized base.AuthorizeCore httpContext..
Setting the httpcontext current session in unit test http://stackoverflow.com/questions/9624242/setting-the-httpcontext-current-session-in-unit-test Unit Tests public class HttpContextFactory private static HttpContextBase m_context public static HttpContextBase Current get if m_context.. private static HttpContextBase m_context public static HttpContextBase Current get if m_context null return m_context if HttpContext.Current.. HttpContext.Current public static void SetCurrentContext HttpContextBase context m_context context You would then replace any calls..
|