Solved

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

Posted on 2010-09-08
4
641 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now