Solved

redirecting the missing pages in asp.net

Posted on 2012-03-13
5
517 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

895 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

12 Experts available now in Live!

Get 1:1 Help Now