Crazy Logouts

Discussion in 'ASP .Net Security' started by Arthur Dent, Sep 6, 2006.

  1. Arthur Dent

    Arthur Dent Guest

    Help please! I am pulling my hair out here!

    i have a forms authentication app, which regularly (not all the time though)
    gives me a page on a protected directory which says "The website declined to
    show this webpage. Most likely causes: This website requires you to log in."
    I cannot figure out for the life of me, if it is not logged in, why is it
    not simply redirecting to the login page, instead of giving me this stupid
    browser error page?

    Here is my relevant code. The pages in the protected directory are also
    killing their cache using the following code:
    Response.Cache.SetNoServerCaching()
    Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache)Response.Cache.SetNoStore()
    Response.Cache.SetExpires(New DateTime(1900, 1, 1, 0, 0, 0, 0))
    I tried it with or without that though, and it didnt change my problem.

    WEB.CONFIG:
    <authentication mode="Forms">
    <forms name="mysiteAUTH" loginUrl="login.aspx"
    defaultUrl="index.aspx" protection="All" timeout="120"
    slidingExpiration="true"/>
    </authentication>
    <location path="admin">
    <system.web>
    <authorization>
    <deny roles="AccessDenied"/>
    <allow roles="Administrator"/>
    <deny users="?,*" />
    </authorization>
    </system.web>
    </location>

    GLOBAL.ASAX:
    Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As
    EventArgs)
    If Request.IsAuthenticated Then
    '// ADD CUSTOM ROLES FROM DB TABLE
    Dim setting As String = Context.User.Identity.Name &
    General.HandleUserRoles
    HttpContext.Current.User = New GenericPrincipal(User.Identity,
    CType(Application(setting), String()))
    End If
    End Sub
    Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
    Session(General.HandleLastEx) = New Exception
    Session(General.HandleSessionUser) = New Definitions.UserBase
    End Sub
     
    Arthur Dent, Sep 6, 2006
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Trevor Hartman

    Re: crazy event handlers!

    Trevor Hartman, Jun 25, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    1,091
  2. Matthias Lohrer

    Page.ParseControl drives me crazy

    Matthias Lohrer, Jul 8, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    1,963
    Matthias Lohrer
    Jul 8, 2003
  3. Herve MAILLARD

    IE 5.0 make me crazy...

    Herve MAILLARD, Jul 23, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    469
    Steve C. Orr, MCSD
    Jul 23, 2003
  4. Mike
    Replies:
    5
    Views:
    709
    jasonwitty
    Aug 25, 2006
  5. Navin
    Replies:
    3
    Views:
    826
    Navin
    Jul 28, 2003
  6. Jay Douglas
    Replies:
    0
    Views:
    509
    Jay Douglas
    Aug 28, 2003
  7. Chris Szabo

    crazy behaviour from controls

    Chris Szabo, Oct 16, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    408
    Chris Szabo
    Oct 16, 2003
  8. Larry Tate

    getting confused and going crazy

    Larry Tate, Dec 21, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    667
    Larry Tate
    Dec 21, 2003
Loading...