Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Javascript in a user control not working 17 63
Response.Redirect Open new Form/tab/page? 5 29
Re-position the objects 7 95
Allow space in this pattern 2 46
This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

939 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

8 Experts available now in Live!

Get 1:1 Help Now