locked
HttpModule and FormsAuthentication object.... RRS feed

  • Question

  • User1254222884 posted
    Why doesn't this work? (from inside an HttpModule -- similar code DOES work in an actual aspx page)Private Sub Application_AuthorizeRequest(ByVal sender As Object, ByVal e As System.EventArgs) Handles Application.AuthorizeRequest Dim context As HttpContext = HttpContext.Current If Not context.Request.IsAuthenticated Then FormsAuthentication.SetAuthCookie("TheUser", False) context.Response.Redirect(context.Request.Url.ToString()) End IfThis ends up in an endless loop. So, SetAuthCookie is not setting the IsAuthenticated flag somehow? Any ideas?
    Thursday, January 27, 2005 2:09 PM

All replies

  • User1254222884 posted
    DOH! I did not have <authentication mode="Forms"/> set! Once that setting is in Web.config, the code I posted works as expected. Cheers,
    Thursday, January 27, 2005 3:24 PM