473,394 Members | 1,774 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,394 software developers and data experts.

Redirect Options

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 to possibly load exist within
that site. The site owner says he wants to be able to specify any of his
existing pages as the site's default - and to change it whenever he wants.
So I'm adding a table to the db which will hold the site's "current
default.aspx". The Page_Load logic behind default.aspx will look to that
table to determine if it should continue to load itself or instead send a
different page altogether down to the browser.

I'd appreciate some advice on which of the redirection options I should use.
As I see it, here are the possibilities:
1. Response.Redirect
2. Server.Transfer
3. HttpContext.RewritePath
4. Server.Execute
? other possibilities?

So, if you had this requirement, how would you go about implementing it?
Thoughts? Rationalle?

Thanks!
Nov 18 '05 #1
3 2905
I'd probably lean towards using RewritePath in an HttpModule with a
Begin_Request event handler. This would keep the logic of selecting
which page to execute outside of the page execution.

The drawbacks here are that you'll need to RewritePath a second time
to get the correct Action tags on any pages that POST back, and use
ResolveUrl to link to images in some scenarios. If this causes too
many problems, Server.Transfer might be easier imlementation wise.

I'd probably shy away from Response.Redirect, not just because it
involves a round trip, but because the users will get the URL to the
"other" default page and might just bookmark it, meaning all the logic
and table setup will go to waste. Server.Execute could present the
same problems with POST backs as mentioned earlier.

--
Scott
http://www.OdeToCode.com/

On Thu, 7 Oct 2004 13:31:58 -0700, "Guadala Harry" <GM**@NoSpam.com>
wrote:
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 to possibly load exist within
that site. The site owner says he wants to be able to specify any of his
existing pages as the site's default - and to change it whenever he wants.
So I'm adding a table to the db which will hold the site's "current
default.aspx". The Page_Load logic behind default.aspx will look to that
table to determine if it should continue to load itself or instead send a
different page altogether down to the browser.

I'd appreciate some advice on which of the redirection options I should use.
As I see it, here are the possibilities:
1. Response.Redirect
2. Server.Transfer
3. HttpContext.RewritePath
4. Server.Execute
? other possibilities?

So, if you had this requirement, how would you go about implementing it?
Thoughts? Rationalle?

Thanks!


Nov 18 '05 #2
Hi Scott,
<<you'll need to RewritePath a second time to get the correct Action tags on
any pages that POST back>>

All of the pages that could be redirected to do in fact POST back... So,
given that fact, can it be an easy conclusion that I should just go with
Server.Transfer in order to have the "cleanest" implementation?

-GH


"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:rv********************************@4ax.com...
I'd probably lean towards using RewritePath in an HttpModule with a
Begin_Request event handler. This would keep the logic of selecting
which page to execute outside of the page execution.

The drawbacks here are that you'll need to RewritePath a second time
to get the correct Action tags on any pages that POST back, and use
ResolveUrl to link to images in some scenarios. If this causes too
many problems, Server.Transfer might be easier imlementation wise.

I'd probably shy away from Response.Redirect, not just because it
involves a round trip, but because the users will get the URL to the
"other" default page and might just bookmark it, meaning all the logic
and table setup will go to waste. Server.Execute could present the
same problems with POST backs as mentioned earlier.

--
Scott
http://www.OdeToCode.com/

On Thu, 7 Oct 2004 13:31:58 -0700, "Guadala Harry" <GM**@NoSpam.com>
wrote:
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 differentpage instead of default.aspx. The other pages to possibly load exist withinthat site. The site owner says he wants to be able to specify any of his
existing pages as the site's default - and to change it whenever he wants.So I'm adding a table to the db which will hold the site's "current
default.aspx". The Page_Load logic behind default.aspx will look to that
table to determine if it should continue to load itself or instead send a
different page altogether down to the browser.

I'd appreciate some advice on which of the redirection options I should use.As I see it, here are the possibilities:
1. Response.Redirect
2. Server.Transfer
3. HttpContext.RewritePath
4. Server.Execute
? other possibilities?

So, if you had this requirement, how would you go about implementing it?
Thoughts? Rationalle?

Thanks!

Nov 18 '05 #3
That would be pretty clean, but I'd do a little prototyping to make
sure nothing odd happens for the exact architecture you are using.

--
Scott
http://www.OdeToCode.com/

On Thu, 7 Oct 2004 13:58:14 -0700, "Guadala Harry" <GM**@NoSpam.com>
wrote:
Hi Scott,
<<you'll need to RewritePath a second time to get the correct Action tags on
any pages that POST back>>

All of the pages that could be redirected to do in fact POST back... So,
given that fact, can it be an easy conclusion that I should just go with
Server.Transfer in order to have the "cleanest" implementation?

-GH


"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:rv********************************@4ax.com.. .
I'd probably lean towards using RewritePath in an HttpModule with a
Begin_Request event handler. This would keep the logic of selecting
which page to execute outside of the page execution.

The drawbacks here are that you'll need to RewritePath a second time
to get the correct Action tags on any pages that POST back, and use
ResolveUrl to link to images in some scenarios. If this causes too
many problems, Server.Transfer might be easier imlementation wise.

I'd probably shy away from Response.Redirect, not just because it
involves a round trip, but because the users will get the URL to the
"other" default page and might just bookmark it, meaning all the logic
and table setup will go to waste. Server.Execute could present the
same problems with POST backs as mentioned earlier.

--
Scott
http://www.OdeToCode.com/

On Thu, 7 Oct 2004 13:31:58 -0700, "Guadala Harry" <GM**@NoSpam.com>
wrote:
>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 completelydifferent >page instead of default.aspx. The other pages to possibly load existwithin >that site. The site owner says he wants to be able to specify any of his
>existing pages as the site's default - and to change it whenever hewants. >So I'm adding a table to the db which will hold the site's "current
>default.aspx". The Page_Load logic behind default.aspx will look to that
>table to determine if it should continue to load itself or instead send a
>different page altogether down to the browser.
>
>I'd appreciate some advice on which of the redirection options I shoulduse. >As I see it, here are the possibilities:
>1. Response.Redirect
>2. Server.Transfer
>3. HttpContext.RewritePath
>4. Server.Execute
>? other possibilities?
>
>So, if you had this requirement, how would you go about implementing it?
>Thoughts? Rationalle?
>
>Thanks!
>


Nov 18 '05 #4

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

Similar topics

12
by: Andrew Chalk | last post by:
In a Python script running under CGI, can I programatically redirect the program to another page. Assume that I have a static HTML page that I want displayed (e.g. index.htm). Other than 'print...
8
by: Victor | last post by:
I need to redirect to another web page, but that redirect will include the submission of form data. So, unlike ServerXMLHTTP which stays on the originating web page, I need the script to redirect...
4
by: Van Duijn | last post by:
I use an inlineframe to display pages with images with javascript pop up links. These image pages redirect to each other with the trusted <meta http-equiv="refresh" content="10; url=vb9.htm">...
9
by: Glen | last post by:
I'm writing a console utility to download specific files from web sites based on the command line options. In most cases, I can trap the 404 error when the file isn't available because the...
3
by: questions? | last post by:
I am calling system command in python by os.system() I do, os.system("wget http://blah blah blah") then I run the program by ./programname >redirected file The things put to screen doesn't...
0
by: Stuart Palmer | last post by:
Hi everyone, I'm trying to look for an asp equivilent of .htaccess that is used on apache servers but for use with asp. I am doing a website and moving lots of files into a single directory to...
7
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, I am trying to set this up using asp code and IIS configuration. But it seems not working. Here it is the way I am doing. In IIS I set up a virtual directory with secure communication, I...
8
by: Darrel | last post by:
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...
3
by: Sarah | last post by:
I was wondering if someone might be able to help me with this issue. I have a feeling this has something to do with my host's server settings as I used to be able to get CURL to follow redirects by...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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.