Last post Aug 31, 2013 03:30 PM by PatriceSc
Aug 31, 2013 07:20 AM|Dhinesh16|LINK
I am trying to implement form authentication . What I am trying to do is , I am going to create a cookies if login success .Later I am gonna check that cookies in every request .
To do this, I need to write a custom module for authentication . My doubt is ,if validation failed in that custom module , how to prevent the request from handlers or form other modules like (authorization) ?
Aug 31, 2013 07:37 AM|PatriceSc|LINK
You could likely just redirect to a the login page ? But before, have you seen that ASP.NET already provides form authentication ? See http://msdn.microsoft.com/en-us/library/9wff0kyh(v=vs.100).aspx
Or do you really have a strong reason to implement your own from scratch ?
Aug 31, 2013 07:44 AM|Dhinesh16|LINK
I have seen that link . But my question is , if a request is not authenticated in authetication event of asp.pipeline event , what i should do next to prevent subsiquent events like (authoriztion)?
Aug 31, 2013 08:05 AM|PatriceSc|LINK
Then call http://msdn.microsoft.com/en-us/library/system.web.httpapplication.completerequest.aspx and it should skip directly to the EndRequest event. You
should be able to check it works fine with a detailed IIS trace.
Aug 31, 2013 08:12 AM|Dhinesh16|LINK
protected void Application_AuthenticateRequest(object sender, EventArgs e)
HttpCookie cookies = Request.Cookies[FormsAuthentication.FormsCookieName];
HttpApplication objHttpApplication = (HttpApplication)sender;
if (cookies == null)
Are saying some thing like this ?
Aug 31, 2013 03:30 PM|PatriceSc|LINK
Yes, if this is just to make sure it works, you could add the Application_AuthorizeRequest method (if not already done) and put a breakpoint on it as well as on the CompleteRequest() call. You should then see that AuthorizeRequest happens when CompleteRequest()
is not called but that the breakpoint is not hit any more if CompleteRequest() has been called.
If this is more about adding this as your own HttpModule try for example
Else please be explicit about what is the issue you have or the thing you want to confirm. As always for unusual things, it's best to give an idea of an overall goal as for now, it seems you just create again something that is already provided out of the