K
kristian
I'm using the following entry in my web.config:
web.config
<customErrors mode="On" defaultRedirect="~/CMS/Default.aspx">
<error statusCode="404" redirect="~/CMS/Default.aspx"/>
</customErrors>
And this is in the Global.asax
Global.asax
void Application_Error(object sender, EventArgs e)
{
// Code that runs when an unhandled error occurs
HttpContext ctx = HttpContext.Current;
string path = ctx.Request.Path.ToString();
ctx.Response.Write(path);
ctx.Server.ClearError();
}
When I test this on my laptop using Visual web express I can see the
Request.Path written in the browser, but when I upload it to my
webserver I get the error:
Server Error in '/' Application.
Runtime Error
Description: An application error occurred on the server. The current
custom error settings for this application prevent the details of the
application error from being viewed remotely (for security reasons). It
could, however, be viewed by browsers running on the local server
machine.
I want to use the customErrors and the code inside the global.asax but
how? Why is my webserver returning this message and my local test
isn't?
I dont host my own webserver, the website is hosted by a company and I
have no access to the servers controlpanel.
How can I get this to work?
web.config
<customErrors mode="On" defaultRedirect="~/CMS/Default.aspx">
<error statusCode="404" redirect="~/CMS/Default.aspx"/>
</customErrors>
And this is in the Global.asax
Global.asax
void Application_Error(object sender, EventArgs e)
{
// Code that runs when an unhandled error occurs
HttpContext ctx = HttpContext.Current;
string path = ctx.Request.Path.ToString();
ctx.Response.Write(path);
ctx.Server.ClearError();
}
When I test this on my laptop using Visual web express I can see the
Request.Path written in the browser, but when I upload it to my
webserver I get the error:
Server Error in '/' Application.
Runtime Error
Description: An application error occurred on the server. The current
custom error settings for this application prevent the details of the
application error from being viewed remotely (for security reasons). It
could, however, be viewed by browsers running on the local server
machine.
I want to use the customErrors and the code inside the global.asax but
how? Why is my webserver returning this message and my local test
isn't?
I dont host my own webserver, the website is hosted by a company and I
have no access to the servers controlpanel.
How can I get this to work?