Solved

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

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

772 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