PDA

View Full Version : فعال کردن کد نمایش خطا



masud8002k
جمعه 13 خرداد 1390, 09:40 صبح
سلام
من در وب کانفیگم کد نمایش خطلا رو روشن گذاشتم اما در هنگام اپلود کد نمایش رو نشون نمیده
این هم از کد

<authentication mode="Windows"/>
<customErrors mode="On"></customErrors>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.

<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->

ParsaNM
سه شنبه 21 تیر 1390, 12:46 عصر
تو global.aspx بنويس


protected void Application_Error(object sender, EventArgs e)
{
try
{

HttpException httpException = (HttpException)Server.GetLastError();
Session["LastError"] = httpException;
Server.ClearError();

int httpCode = httpException.GetHttpCode();
switch (httpCode)
{
case 403: Response.Redirect("~/Global/ErrorPage403.aspx"); break;
case 404: Response.Redirect("~/Global/ErrorPage404.aspx"); break;
default: Response.Redirect("~/Global/ErrorPage.aspx"); break;
}

}
catch { }



}