Solved

redirecting the missing pages in asp.net

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

Industry Leaders: 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

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
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.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

685 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