A
Arthur Dent
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
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