?
Solved

custom error won't redirect in asp.net

Posted on 2012-03-14
7
Medium Priority
?
617 Views
Last Modified: 2012-04-04
My web.config is....Any ideas why it won't be redirecting to Error.aspx

<?xml version="1.0" encoding="UTF-8"?>
<configuration>

	<connectionStrings>
		****
	</connectionStrings>

	<location path="Quiz">
		<system.web>
			<authorization>
				<allow users="user"/>
				<deny users="*"/>
			</authorization>
		</system.web>
	</location>
	
	<system.web>
		<customErrors mode="On" defaultRedirect="Error.aspx" >
			
		</customErrors>
		<authentication mode="Forms">
			<forms path="/" loginUrl="~/Login.aspx" protection="All" timeout="2880"/>
		</authentication>
	</system.web>
	
	<system.webServer>
		<defaultDocument>
			<files>
				<clear/>
				<add value="default.aspx"/>
			</files>
		</defaultDocument>
	</system.webServer>
	<system.web>
		
		<sessionState mode="InProc" cookieless="false" timeout="30"/>
		<compilation debug="true" targetFramework="4.0">
			<assemblies>
				<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
				<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
				<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
				<add assembly="System.Speech, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
			</assemblies>
		</compilation>
		<pages maintainScrollPositionOnPostBack="True" enableEventValidation="true"/>
		<httpHandlers>
			<add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false"/>
		</httpHandlers>
	</system.web>
	<system.webServer>
		<validation validateIntegratedModeConfiguration="false"/>
		<handlers>
			<add name="Telerik_Web_UI_WebResource_axd" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource"/>
		</handlers>
	</system.webServer>
</configuration>

Open in new window


I have exactly the same settings on another demo application which works fine. The web.config for that is

<?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>
	<location path="Secure">
		<system.web>
			<authorization>
				<allow users="user"/>
				<deny users="*"/>
			</authorization>
		</system.web>
	</location>
	<system.web>
		<customErrors mode="On" defaultRedirect="Error.aspx"/>
		<compilation debug="true" targetFramework="4.0"/>
		<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="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/>
			</providers>
		</membership>
		<profile>
			<providers>
				<clear/>
				<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
			</providers>
		</profile>
		<roleManager enabled="false">
			<providers>
				<clear/>
				<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/"/>
				<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/"/>
			</providers>
		</roleManager>
	</system.web>
	<system.webServer>
		<modules runAllManagedModulesForAllRequests="true"/>
	</system.webServer>
</configuration>

Open in new window

0
Comment
Question by:mmalik15
[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
  • 3
7 Comments
 
LVL 14

Expert Comment

by:nishant joshi
ID: 37719691
you web config is same but once try to check web site configurations from

Web Site Administration Tool, on the Website menu, click ASP.Net Configuration

and check for error and set page.

Regards,
nishant
0
 

Author Comment

by:mmalik15
ID: 37719735
I am using IIS 7.5 Sorry where do you get website admin tool?
0
 
LVL 14

Accepted Solution

by:
nishant joshi earned 2000 total points
ID: 37719766
in visual studio..
0
Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

 

Author Comment

by:mmalik15
ID: 37719900
i have tried setting the page through that tool. When I try to debug the application it won't debug. when i try to run without debugging i m getting this error

HTTP Error 500.23 - Internal Server Error
An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.
0
 

Author Comment

by:mmalik15
ID: 37720019
i worked it out by putting

<customErrors mode="On" defaultRedirect="~/Error.aspx" >

            </customErrors>

inside the last <system.web> web.config node. don't no why it has to be in the last node of <system.web> but it  is working now :s :)
0
 

Author Comment

by:mmalik15
ID: 37720024
Resolve web.config

<?xml version="1.0" encoding="UTF-8"?>

<configuration>

	<system.webServer>
		<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
			<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
			<dynamicTypes>
				<add mimeType="text/*" enabled="true" />
				<add mimeType="message/*" enabled="true" />
				<add mimeType="application/javascript" enabled="true" />
				<add mimeType="*/*" enabled="false" />
			</dynamicTypes>
			<staticTypes>
				<add mimeType="text/*" enabled="true" />
				<add mimeType="message/*" enabled="true" />
				<add mimeType="application/javascript" enabled="true" />
				<add mimeType="*/*" enabled="false" />
			</staticTypes>
		</httpCompression>
		<urlCompression doStaticCompression="true" doDynamicCompression="true" />

		<!--<httpErrors errorMode="Custom" defaultResponseMode="ExecuteURL" defaultPath="~/default.aspx">

			<clear/>
			<error statusCode="404" responseMode="ExecuteURL" path="~/default.aspx/"/>
		</httpErrors>-->
	</system.webServer>

	<connectionStrings>

		*****

	</connectionStrings>


	<!--<system.net>
		<mailSettings>
			<smtp from="support@practicelifeintheuktest.co.uk">
				<network host="relay-hosting.secureserver.net"/>
			</smtp>
		</mailSettings>
	</system.net>-->




	<location path="Quiz">



		<system.web>

			<authorization>

				<allow users="user" />
				<deny users="*" />

			</authorization>

		</system.web>

	</location>

	<system.webServer>

		<defaultDocument>
			<files>
				<clear />
				<add value="default.aspx" />
			</files>
		</defaultDocument>
	</system.webServer>



	<system.web>
		<customErrors mode="On" defaultRedirect="~/default.aspx" >

		</customErrors>
		<authentication mode="Forms">
			<forms path="/" loginUrl="~/Login.aspx" protection="All" timeout="5" />
		</authentication>


		<sessionState mode="InProc" cookieless="false" timeout="30" />

		<compilation debug="true" targetFramework="4.0">
			<assemblies>
				<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
				<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
				<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
				<add assembly="System.Speech, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
			</assemblies>
		</compilation>
		<pages maintainScrollPositionOnPostBack="True" enableEventValidation="true" />
		<httpHandlers>
			<add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" />
		</httpHandlers>

	</system.web>


	<system.webServer>
		<validation validateIntegratedModeConfiguration="false" />
		<handlers>
			<add name="Telerik_Web_UI_WebResource_axd" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" />
		</handlers>
	</system.webServer>
</configuration>

Open in new window

0
 
LVL 14

Expert Comment

by:nishant joshi
ID: 37721892
might having an problem with application pools in IIS check.Application pull .net version is 4.0 or not?
0

Featured Post

How Blockchain Is Impacting Every Industry

Blockchain expert Alex Tapscott talks to Acronis VP Frank Jablonski about this revolutionary technology and how it's making inroads into other industries and facets of everyday life.

Question has a verified solution.

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

When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month13 days, 10 hours left to enroll

800 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