473,395 Members | 1,452 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

301 redirect HTML to ASPX. options?

I'm helping convert a 300+ page .html site into an ASP.net site.

The client wants to set up 301 redirects for all of the old html pages. I've
used ISAPI for this type of thing in the past, as it works great and is easy
to set up, but at this point, the client (which is my client, who's working
with the actual client) doesn't know what the new web host supports.

In the interim, I want to do a bit of research myself on this to see if it's
anything I can handle on my end. It's in asp.net 1.1 right now, and from
what I can tell, it's quite easy to add a 301 redirect to an existing aspx
page. However, these are all .html pages, so it appears I'm out of luck with
that.

Do I have any other options to pursue outside of ISAPI Rewrite?

Converting to 2.0 probably isn't an option for this project, but that would
help in the future, correct, as ALL files can be intercepted by the .net
engine, correct? If that's true, is there any way to leave the current site
as an ASP.net 1.1 site but run a 'wrapper' application of some sort in 2.0
that can handle the 301 intercept/rewrites?

-Darrel
Dec 28 '07 #1
8 4888
You could put the old url and the new url in a sql table or a file and
have
one page that looks it up in the table and redirects
You can then set one
redirect in IIS on the web site level to send all traffic to your new page
instead of 300 different ones, one for each page.
Ah! That might work! So, IIS redirects to my page, and my page then does the
301 redirect. In that case, what kind of redirect do I use in IIS?

-Darrel
Dec 28 '07 #2
On Thu, 27 Dec 2007 20:53:00 -0800, Mohamad Elarabi [MCPD]
<Mo****************@discussions.microsoft.comwrote :
>You could put the old url and the new url in a sql table or a file and have
one page that looks it up in the table and redirects. You can then set one
redirect in IIS on the web site level to send all traffic to your new page
instead of 300 different ones, one for each page.
Or make the root name of the aspx page the same as the html. You can
then replace the html in the original URL string with aspx and
redirect. That way you do not need the sql table the rest of the
redirect would remain as described.

This method also has the side effect that the structure of the site
remains the same so anyone working on the system using the old html
files will be familiar with the new layout. Effectively they are the
same.

Cheers,
Mark
--
|\ _,,,---,,_ A picture used to be worth a
ZZZzzz /,`.-'`' -. ;-;;, thousand words - then along
|,4- ) )-,_. ,\ ( `'-' came television!
'---''(_/--' `-'\_)

Mark Stevens (mark at thepcsite fullstop co fullstop uk)

This message is provided "as is".
Dec 28 '07 #3
That would be true if he had 300 different aspx pages. But I doubt he has as
many aspx pages as his old HTML ones otherwise why bother with aspx.
My assumption is that he has a handful of aspx pages that can serve up
dynamic content that used to be hosted over 300 different html pages.

--
Mohamad Elarabi
MCP, MCTS, MCPD.
"Mark Stevens" wrote:
On Thu, 27 Dec 2007 20:53:00 -0800, Mohamad Elarabi [MCPD]
<Mo****************@discussions.microsoft.comwrote :
You could put the old url and the new url in a sql table or a file and have
one page that looks it up in the table and redirects. You can then set one
redirect in IIS on the web site level to send all traffic to your new page
instead of 300 different ones, one for each page.

Or make the root name of the aspx page the same as the html. You can
then replace the html in the original URL string with aspx and
redirect. That way you do not need the sql table the rest of the
redirect would remain as described.

This method also has the side effect that the structure of the site
remains the same so anyone working on the system using the old html
files will be familiar with the new layout. Effectively they are the
same.

Cheers,
Mark
--
|\ _,,,---,,_ A picture used to be worth a
ZZZzzz /,`.-'`' -. ;-;;, thousand words - then along
|,4- ) )-,_. ,\ ( `'-' came television!
'---''(_/--' `-'\_)

Mark Stevens (mark at thepcsite fullstop co fullstop uk)

This message is provided "as is".
Dec 28 '07 #4
IIS would be set to redirect to a single URL as I specified in my original
post. You would right click on the web site/Properties/Home Page Tab/"A
redirection to a URL" and in the text box you'd specify the exact url to your
new redirector aspx page and pass it the old url in the query string. It
should look something like this

http://myNewAppDomain/myRedirectorPage.aspx?OldURL=$S

Note that the $S should translate to the originally requested URL and it
should come to youe aspx page in a querystring variable called OldURL. You'd
parse that value and use it to lookup the page that you'll need to redirect
to.

If your aspx page is on the same site you can specify a virtual path instead
of an http:\\... one. There are other redirection options like redirecting to
a virtual folder under the same website. Unfortunately I am unable to help
you with anymore specific details since I don't have access to an IIS6.0 box
at the mean time. All I have access to is IIS7 on my vista laptop which is
entirely different. So hopefully the IIS interface is intuitive enough for
you to maneuver, I'm sure you can figure it out at least by trial and error
if need be. Also consider doing a Server.Transfer in your redirector page to
save a roundtrip this way your clients won't take 3 requests to get to their
target.

Hope this is clearer. Let me know.

--
Mohamad Elarabi
MCP, MCTS, MCPD.
"Darrel" wrote:
You could put the old url and the new url in a sql table or a file and
have
one page that looks it up in the table and redirects
You can then set one
redirect in IIS on the web site level to send all traffic to your new page
instead of 300 different ones, one for each page.

Ah! That might work! So, IIS redirects to my page, and my page then does the
301 redirect. In that case, what kind of redirect do I use in IIS?

-Darrel
Dec 28 '07 #5
That would be true if he had 300 different aspx pages. But I doubt he has
as
many aspx pages as his old HTML ones otherwise why bother with aspx.
Exactly. ;o)

Your answer makes sense. Though, is this HAS to be a 301 redirect. Does the
method of using the one aspx page result in (or can it result in) a 301
redirect message being sent back?
Dec 30 '07 #6
IF you do a response.redirect(RedirectionURLHere) then it is a 301 redirect
but if you do a Server.Transfer it won't look like a redirect to the client.
In general you want to minimize the number of 301 redirects because each one
is a round trip between the server and the client. So you set IIS to do a
redirect to your ASPX page and then your page can redirect again to the
target alternative. Now I'm not sure if the IIS redirect is a 301 or is it
seamless to the client, but my guess is that it is a 301 redirect. However,
if IIS doesn't do a 301 and you insist on having a 301 then your ASPX can do
a Response.Redirect instead of a Server.Transfer.

In any case your client will not see a page that says "This page has moved,
you will be redirected in 5 seconds, if you're not redirected click here . .
.. " because this kind of page is something you'll need to write yourself. So
if that is what you want then your aspx page will need to do so and set a
refresh on the body tag of the page.

Hope that helps.

--
Mohamad Elarabi
MCP, MCTS, MCPD.
"Darrel" wrote:
>
That would be true if he had 300 different aspx pages. But I doubt he has
as
many aspx pages as his old HTML ones otherwise why bother with aspx.

Exactly. ;o)

Your answer makes sense. Though, is this HAS to be a 301 redirect. Does the
method of using the one aspx page result in (or can it result in) a 301
redirect message being sent back?
Dec 30 '07 #7


can u tell how to convert HTML pages to ASPX plzzz

*** Sent via Developersdex http://www.developersdex.com ***
Mar 7 '08 #8
Just rename them from .htm to .aspx
Also you will need to add first line <%@Page% (may be not i am not sure).

George.
"chanda roopesh" <ch************@yahoo.comwrote in message
news:ep**************@TK2MSFTNGP05.phx.gbl...
>

can u tell how to convert HTML pages to ASPX plzzz

*** Sent via Developersdex http://www.developersdex.com ***

Mar 7 '08 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Nazir | last post by:
I am trying to do something pretty simple - but can't see how it can be done in ASP.NET. I have an aspx web page with a form which opens up a new window. The web page uses code behind to build...
3
by: Guadala Harry | last post by:
I need to add logic to the Page_Load event behind a site's default.aspx; that will allow either default.aspx to load - OR load a completely different page instead of default.aspx. The other pages...
4
by: bnob | last post by:
In a Button clik event I have this code at the end of the event Response.Redirect("Page.aspx") But in this event I must show a message before redirect to the Page.aspx. I use to show Message...
3
by: michael_vanommeren | last post by:
I have two web applications that I am working with and I am trying to do a Response.Redirect from one to the other. They are setup as separate web applications on the same IIS server. If I go...
2
by: news://news.microsoft.com/microsoft.public.de.germ | last post by:
Hallo! Ich habe ein Frameset mit 3 Frames. Im 1. Frame wird eine ASPX-Seite geöffnet. In dieser werden einige Steuerelemente angezeigt. Nun soll bei bestimmten Benutzeraktivitäten eine andere...
15
by: KBuser | last post by:
I recently developed an internal website with various queries against our SQL server. I added buttons with Response.Redirect. These buttons do not work with Internet Explorer, however when using...
3
by: wwwmike | last post by:
For some reasons my HTTP Redirect for 404 errors does not work for certain files like .gif .jpg on IIS Version: 5.1, but it works perfectly with the VisualStudio2005 internal webserver ...
0
by: omer013 | last post by:
Hi; I have an aspx page with a WebMethod to redirect the user to another page. The Default.aspx.cs is; public partial class _Default : System.Web.UI.Page { public static void...
7
by: seanmatthewwalsh | last post by:
Hi I have a page (default.aspx) that pulls it's HTML from a database. I then have a "content management" page (editpage.aspx) that allows the user to edit the HTML in the database. When the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.