Solved

I am not sure how to add the line in Web.Config

Posted on 2010-09-08
4
648 Views
Last Modified: 2012-05-10
This <customErrors> tag should then have its "mode" attribute set to "Off".
Can you show me how add this line to my Web.Config file?


Server Error in '/ATech' 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.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".


<!-- Web.Config Configuration File -->

<configuration>
    <system.web>
        <customErrors mode="Off"/>
    </system.web>
</configuration>
 

Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.


<!-- Web.Config Configuration File -->

<configuration>
    <system.web>
        <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
    </system.web>
</configuration>
 
0
Comment
Question by:goodk
4 Comments
 
LVL 7

Accepted Solution

by:
iopen earned 500 total points
ID: 33626366
in the Web.Config file you add

<configuration>
    <system.web>

       \\<customErrors mode="Off"/>

     <customErrors mode="RemoteOnly" defaultRedirect="/pageError.aspx">
     <error statusCode="404" redirect="/noLink.aspx"/>
     <error statusCode="403" redirect="/pageError.aspx"/>
     <error statusCode="500" redirect="/pageError.aspx"/>
     </customErrors>

 </system.web>
</configuration>

When I want to see the error I uncomment the Mode Off and comment out the Mode RemoteOnly
0
 
LVL 3

Expert Comment

by:aledev
ID: 33626389
Can you post your web.config file?
0
 
LVL 9

Expert Comment

by:abhinayp86
ID: 33627183
I understand that u r getting this error (in yellow) when in dev or int or prod.
Whenever ur website errors out due to some exception, u get this page.
To see the actual error under these circumstances, go to web.config. Find the customerrors tag (do a ctrl + f).
It will already have mode as mode="RemoteOnly". Set it to mode = "Off". And now you can see the actual error.

If you cant find the "CustomErrors" tag,
anywhere under system.web tag, put this

   

----

But generally. we display a friendly error page.
refer this link
http://www.codeproject.com/KB/aspnet/Error_Page_for_aspnst.aspx
0
 

Author Comment

by:goodk
ID: 33628014
 Server Error in '/ATech' Application. Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.

Source Error:

Line 14: Line 15: <system.web> Line 16: <compilation debug="false" targetFramework="4.0"/> Line 17: Line 18: <customErrors mode="Off"/>
Source File: \\nawinfs02\home\users\web\b393\rh.kbhatti\ATech\web.config    Line: 16

Version Information: Microsoft .NET Framework Version:2.0.50727.3615; ASP.NET Version:2.0.50727.3082
 
my code:
 

<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433 
-->
<configuration>
<connectionStrings>
<add name="ApplicationServices"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<compilation debug="false" targetFramework="4.0"/>
<customErrors mode="Off"/>
<!-- Web.Config Configuration File -->
 
 


<!--
<customErrors mode="RemoteOnly" defaultRedirect="/pageError.aspx">
<error statusCode="404" redirect="/noLink.aspx"/>
<error statusCode="403" redirect="/pageError.aspx"/>
<error statusCode="500" redirect="/pageError.aspx"/>
</customErrors>
-->
 
<authentication mode="Forms">
<forms loginUrl="~/Account/Login.aspx" timeout="2880" />
</authentication>
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices"
enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
maxInvalidPasswordAttempts="20" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="20"
applicationName="/" />
</providers>
</membership>
<profile>
<providers>
<clear/>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
</providers>
</profile>
<roleManager enabled="true">
<providers>
<clear />
<add connectionStringName="ApplicationServices" applicationName="/"
name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" />
<add applicationName="/" name="AspNetWindowsTokenRoleProvider"
type="System.Web.Security.WindowsTokenRoleProvider" />
</providers>
</roleManager>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question