Solved

redirecting the missing pages in asp.net

Posted on 2012-03-13
5
516 Views
Last Modified: 2012-08-13
there are roughly 50-60 old pages which are deleted from my website www.lifeintheuktest.co and are in google index e.g. the following page http://www.lifeintheuktest.co/lifeintheuktest/archive.aspx

These pages when clicked through the search results return 404 error. I want to redirect from these pages to defualt.aspx and also want to remove them from google index. how can I redirect the missing pages to default.aspx
0
Comment
Question by:mmalik15
  • 2
  • 2
5 Comments
 
LVL 4

Expert Comment

by:Paul-B
ID: 37717684
You could just set a custom 404 page for the site that has a meta refresh tag in it ...

In your new 404 page just put a line like...

<meta http-equiv="refresh" content="0;url=http://www.lifeintheuktest.co/default.aspx"> 

Open in new window

0
 
LVL 2

Expert Comment

by:JAruchamy
ID: 37717697
Hi,

Try this in web.config

<configuration>
    <system.web>
         <customErrors defaultRedirect="error.aspx" mode="On" />
    </system.web>
</configuration>

http://www.codeproject.com/Articles/2345/Custom-Errors-in-ASP-NET
0
 

Author Comment

by:mmalik15
ID: 37717734
Please see my web.config but for some reason its still not redirecting as you can see from the pages e.g.

http://www.lifeintheuktest.co/lifeintheuktest/?tag=/ESOL
http://www.lifeintheuktest.co/lifeintheuktest/2011/12/default.aspx

<?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" />
        <httpRedirect enabled="false" destination="" exactDestination="false" childOnly="false" httpResponseStatus="Found" />
		
	</system.webServer>

	<connectionStrings>

		*******
		

	</connectionStrings>


	

	<location path="Quiz">

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

		<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>
		<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
 

Author Comment

by:mmalik15
ID: 37717775
And I do have error page in my applications root directory. Please see the attached screenshot
Error-page.jpg
0
 
LVL 2

Accepted Solution

by:
JAruchamy earned 500 total points
ID: 37717989
This happens because the user is not authenticated and u have

<system.web>
      <authorization>
            <allow users="user" />
            <deny users="*" />
      </authorization>
</system.web>
<authentication mode="Forms">
      <forms path="/" loginUrl="~/Login.aspx" protection="All" timeout="5" />
</authentication>

which is required for user authentication....

Read the following... U might get a better Idea

http://www.codeproject.com/Articles/11202/Redirecting-to-custom-401-page-when-quot-Access-de
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

706 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

20 Experts available now in Live!

Get 1:1 Help Now