Solved

redirecting the missing pages in asp.net

Posted on 2012-03-13
5
528 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
[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
  • 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

Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

Question has a verified solution.

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

Suggested Solutions

Running classic asp applications under Windows Server 2008 R2 (x64) and IIS 7 is not as easy as one may think. It took me a while to figure it out while getting error 8002801d a few times. After you install the OS you will need to install the fol…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

710 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