Ask a Question related to ASP.NET General, Design and Development.
-
Edward Jones #1
access denied message for failed authorization
I want to send users to an Access Denied page rather than the Login
page when they are authenticated but not authorized to see a specific
page while using Forms based authentication in ASP.Net.
the solution in VB is to check the status code in the
Global_EndRequest method of the Global.asax. However, in c# you have
to add your own method to the EndRequest event rather than using the
standard Application_EndRequest that exists in the global.asax.
Has anyone else seen this bahavior?
Can anyone explain this behavior?
Is this a bug?
Code in the Global.asax:
protected void Application_EndRequest(Object sender, EventArgs e)
{
System.Diagnostics.Debug.WriteLine("Application_En dRequest");
System.Diagnostics.Debug.WriteLine("URL: " +
HttpContext.Current.Request.Url.AbsolutePath.ToStr ing());
System.Diagnostics.Debug.WriteLine("Staus Code: " +
HttpContext.Current.Response.StatusCode);
System.Diagnostics.Debug.WriteLine("Authenticated: " +
HttpContext.Current.User.Identity.IsAuthenticated) ;
}
protected void Global_EndRequest(Object sender, EventArgs e)
{
System.Diagnostics.Debug.WriteLine("Global_EndRequ est");
System.Diagnostics.Debug.WriteLine("URL: " +
HttpContext.Current.Request.Url.AbsolutePath.ToStr ing());
System.Diagnostics.Debug.WriteLine("Staus Code: " +
HttpContext.Current.Response.StatusCode);
System.Diagnostics.Debug.WriteLine("Authenticated: " +
HttpContext.Current.User.Identity.IsAuthenticated) ;
}
#region Web Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.EndRequest += new
System.EventHandler(this.Global_EndRequest);
}
#endregion
Result:
Global_EndRequest
URL: /WebAuthentication/authenticated/Role4Only.aspx
Staus Code: 401
Authenticated: True
Application_EndRequest
URL: /WebAuthentication/authenticated/Role4Only.aspx
Staus Code: 302
Authenticated: True
Edward Jones Guest
-
Access Denied message
I'm suddenly having a problem editing any page through Contribute. I can get to the website when I start the program, but if I try to edit any... -
JIT Debugging failed with the following error: Access is denied
Hello, I get all the time JIT Debugging failed with the following error: Access is denied. message when trying to my a webservice. MSDN say to... -
The Request Failed with HTTP Status 401: Access Denied
I have a webservice that returns a simple string. The security for this is set to windows authentication in IIS (XP Professional) and anonymous... -
Access denied to Failed to start monitoring file changes.
"Mark" <postOnly@news.group> wrote Mark, Check out the following MS KB articles: FIX: "Failed to Start Monitoring Directory Changes" Error... -
HELP!! Access Denied error message
I recently ran Windows Setup over itself on an XP machine. Setup went fine and the machine runs better. However, the previous installation was...



Reply With Quote

