By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,118 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

Redirect Options

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.