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

I Don't Like Server.Transfer()

In my not so humble opinion, Server.Transfer() looks good on paper, but
I have yet to come across a use for it that couldn't be accomplished
better another way. When it comes down to it, I really dislike the
method because, at least at my company, it leads to bad designs. It
also further irritates end users because it breaks the back button. I
really wish the Server.Transfer() method would go away so people would
stop using it.

What do the rest of you think?

--
Sean
Jan 9 '07 #1
9 1526
re:
It also further irritates end users because it breaks the back button.
It constitutes the perfect answer to the FAQ "How can I disable the back button?".

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"senfo" <en**********@yahoo.comI-WANT-NO-SPAMwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
In my not so humble opinion, Server.Transfer() looks good on paper, but I have yet to come across
a use for it that couldn't be accomplished better another way. When it comes down to it, I really
dislike the method because, at least at my company, it leads to bad designs. It also further
irritates end users because it breaks the back button. I really wish the Server.Transfer() method
would go away so people would stop using it.

What do the rest of you think?

--
Sean

Jan 9 '07 #2
Like anything, only use something when it is appropriate. If it is more
appropriate to you to use Redirect then do so. I use Transfer when
implementing my own handlers so that the user's URL remains what they think
it is while the page they are viewing is something else.

"senfo" <en**********@yahoo.comI-WANT-NO-SPAMwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
In my not so humble opinion, Server.Transfer() looks good on paper, but I
have yet to come across a use for it that couldn't be accomplished better
another way. When it comes down to it, I really dislike the method
because, at least at my company, it leads to bad designs. It also further
irritates end users because it breaks the back button. I really wish the
Server.Transfer() method would go away so people would stop using it.

What do the rest of you think?

--
Sean

Jan 9 '07 #3
"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:e5**************@TK2MSFTNGP03.phx.gbl...
re:
>It also further irritates end users because it breaks the back button.

It constitutes the perfect answer to the FAQ "How can I disable the back
button?".
:-)
Jan 9 '07 #4
Aidy wrote:
Like anything, only use something when it is appropriate. If it is more
appropriate to you to use Redirect then do so. I use Transfer when
implementing my own handlers so that the user's URL remains what they think
it is while the page they are viewing is something else.
If I don't want my URL to change between postbacks, I just implement
panels and set their Visible property as appropriate. That way I have
*direct* access to the controls on their values.

--
Sean
Jan 9 '07 #5
senfo wrote:
That way I have *direct* access to the controls on their values.
Erg...Should have read my post before submitting it! That should have
read, "controls and their values", not "on".
Jan 9 '07 #6
If I don't want my URL to change between postbacks, I just implement
panels and set their Visible property as appropriate. That way I have
*direct* access to the controls on their values.
It's not that I want the URL to remain the same, I want "user friendly" page
names that hide ?ID=123456 type affairs.

Besides, putting everything on one page in panels would be a nightmare to
maintain. You'd be better off using a FRAME.
Jan 9 '07 #7
Aidy wrote:
>If I don't want my URL to change between postbacks, I just implement
panels and set their Visible property as appropriate. That way I have
*direct* access to the controls on their values.

It's not that I want the URL to remain the same, I want "user friendly" page
names that hide ?ID=123456 type affairs.

Besides, putting everything on one page in panels would be a nightmare to
maintain. You'd be better off using a FRAME.
Not true, at all. And frames are an outright horrible design, but
that's another topic, altogether.

For a search page, I almost always have the input controls on a
Search.aspx page and then pass search criteria through a query string to
a SearchResults.aspx. It makes it easy to bookmark and also makes
scaling much easier. If, however, I didn't want to use a QueryString
for whatever reason, I'd just POST the values to the SearchResults.aspx
page and access them through the PreviousPage property.

For a page that adds a new record to a database and then displays a
confirmation (e.g, a sign up page), I'd most likely provide multiple
panels that I can either hide or show. The initial SignUp.aspx page,
for example, would display all the controls necessary to sign up for my
site. After a user clicks the "Submit" button, I'd hide the original
panel and display only the conformation. It simply makes sense, to me,
that the confirmation be contained within the same page. I could have
used Server.Transfer() and transfered to a page that had the
confirmation in the HTML, but that just wouldn't be as clean. Now if
you've got 10+ panels on your page and you need 1,000 lines of code to
determine which panel should be displayed, you probably should look into
splitting the panels up into multiple pages.

These are obviously two simple examples, but they scale quite nicely and
it's amazing how often I play on these two ideas with only a slight
variation.

Like I said before, I have yet to find any site that uses
Server.Transfer() that couldn't have accomplished the same concept more
cleanly using an alternative. It simply creates more problems than it
solves.

--
Sean
Jan 9 '07 #8
Peter Bromberg [C# MVP] wrote:
If you don't like Server.Transfer, nobody is holding a gun to your head. :-)
Peter
It's not really so much me (I avoid using it), it's that I see it used
time and time again on sites I've maintained. Every single time I've
run across it, there was some kind of issue that it was creating that
ultimately left me with having to resolve it by moving to an
alternative. To me, it's such a bad idea to begin with that I wish it
would be removed from ASP.NET, altogether, to prevent *other* people
from using it.

--
Sean
Jan 9 '07 #9
Like I said before, I have yet to find any site that uses
Server.Transfer() that couldn't have accomplished the same concept more
cleanly using an alternative. It simply creates more problems than it
solves.
And as I said, I have a site that uses it for a form of URL rewriting.
However I admit it is the only time I've used it. To suggest it is removed
just cos you've never found a use for it is silly, if not arrogant. I can
still see where it can be useful for other people (let's say you want to
split processing across three pages, you could Transfer between them and
Redirect on the last page), just cos I've rarely done something that uses it
I can appreciate its value.

If you don't need it, don't use it.
Jan 10 '07 #10

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

Similar topics

4
by: Harsh Thakur | last post by:
Hi, I'd like to know the performance related differences between Response.Redirect and Server.Transfer. I'd like to redirect the user to a different page. I can either do a...
9
by: Mark | last post by:
Hello I'm trying to use a Server.Transfer in a try-catch (I cannot put it outside the Try-Catch as it is nested deep within a component that is called in a try-catch loop) The problem is that the...
11
by: Alexander Bosch | last post by:
Hi, I'm having a problem similar to the one that's stated in this KB http://support.microsoft.com/default.aspx?scid=kb;en-us;839521 When I'm posting a page to itself with the bool value as true it...
1
by: Alexander Bosch | last post by:
Hi, I'm sorry for the double posting, but I haven't got any solution for this and I'm still puzzled by this KB http://support.microsoft.com/default.aspx?scid=kb;en-us;839521 that's saying this...
8
by: bryan | last post by:
I've got a custom HttpHandler to process all requests for a given extension. It gets invoked OK, but if I try to do a Server.Transfer I get an HttpException. A Response.Redirect works, but I really...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...

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.