Solved

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

Posted on 2010-09-08
4
654 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

717 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