Tuesday, March 1, 2011

Make Your Own Wrestling Singlets



A common problem when working on ASP.NET MVC projects I've encountered, is the subject of timeouts caused by the expiry of the session, especially when the cookie is still in place. Looking

here and there I found what appears to be the least elaborate, and this is above OnActionExecuting writing and checking if we still have a session, or if a new and still remains in place the "cookie." ..


/ / / \u0026lt;summary>
/ / / occurs prior to the execution of an action method.
/ / / \u0026lt;/ summary>
/ / / \u0026lt;param name= "contextoFiltro" > Context implementation of the controller. \u0026lt;/ param>
protected override void OnActionExecuting ( ActionExecutingContext contextoFiltro) {

basis. OnActionExecuting (contextoFiltro);

if (this . ControllerContext.HttpContext.Session! = null )
; {if
(Session.IsNewSession) {

string cabeceraCookie = Request.Headers [ Cookie ] if

((null ! = cabeceraCookie) & & (cabeceraCookie.IndexOf ( "ASP.NET_SessionId" )> = 0))
; {
RedirectToAction ( "LogOn" , "Account" , {area = new string . Empty});}

;}
}}


One thing I like to try is how to detect terms and logins in a programmatic manner, for example, through a WCF service that I may have to generate statistics of the use made of traditional authentication mechanism based on sessions.

Using ASP.NET context data from WCF should not be a problem, I think.

0 comments:

Post a Comment