473,386 Members | 1,753 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.

Server.Transfer vs Response.Redirect

Hi everyone,
I don't know if there's anyone out there is having the same problem. My
DotNet 1.1 version uses FormsAuthentication.RedirectFromLoginPage() method to
take user from the Login page to the Welcome page. My folder structure is as
follows:
Root Dir
bin
images
secure
Welcome
Folder1
Page1
Folder 2
Page 2
login
stylesheet
web.config

To navigate to other pages within the application, Server.Transfer() method
seems to lose its node's coordinates relative to the whole tree structure.
For example, the Welcome page references the stylesheet as ../stylesheet.css
and Page1's reference is ../../stylesheet.css. When I used Server.Transfer
method to go to Page1 from Welcome page, Page1 cannot find the stylesheet.
However, if I replace Server.Transfer with Response.Redirect, all relative
references are ok.
Can someone shed some light on this problem of mine and tell me what i have
done wrong?
Any help is greatly appreciated.
KD
Nov 19 '05 #1
3 2783
Instead of using the .../. Use the ~ to say go to the root directory.

Server.Transfer("~/secure/Welcome.aspx");

--
TDAVISJR
aka - Tampa.NET Koder
"Calvin KD" <Ca******@discussions.microsoft.com> wrote in message
news:CC**********************************@microsof t.com...
Hi everyone,
I don't know if there's anyone out there is having the same problem. My
DotNet 1.1 version uses FormsAuthentication.RedirectFromLoginPage() method
to
take user from the Login page to the Welcome page. My folder structure is
as
follows:
Root Dir
bin
images
secure
Welcome
Folder1
Page1
Folder 2
Page 2
login
stylesheet
web.config

To navigate to other pages within the application, Server.Transfer()
method
seems to lose its node's coordinates relative to the whole tree structure.
For example, the Welcome page references the stylesheet as
../stylesheet.css
and Page1's reference is ../../stylesheet.css. When I used Server.Transfer
method to go to Page1 from Welcome page, Page1 cannot find the stylesheet.
However, if I replace Server.Transfer with Response.Redirect, all relative
references are ok.
Can someone shed some light on this problem of mine and tell me what i
have
done wrong?
Any help is greatly appreciated.
KD

Nov 19 '05 #2
When you use server transfer, the url doesn't change - so your page
thinks it is the first page

from default.asp;

server.transfer "another-folder/anotherfile.asp"
request.servervariables( "script_name" ) will return "default.asp" from
both pages .. thats by design

Calvin KD wrote:
Hi everyone,
I don't know if there's anyone out there is having the same problem. My
DotNet 1.1 version uses FormsAuthentication.RedirectFromLoginPage() method to
take user from the Login page to the Welcome page. My folder structure is as
follows:
Root Dir
bin
images
secure
Welcome
Folder1
Page1
Folder 2
Page 2
login
stylesheet
web.config

To navigate to other pages within the application, Server.Transfer() method
seems to lose its node's coordinates relative to the whole tree structure.
For example, the Welcome page references the stylesheet as ../stylesheet.css
and Page1's reference is ../../stylesheet.css. When I used Server.Transfer
method to go to Page1 from Welcome page, Page1 cannot find the stylesheet.
However, if I replace Server.Transfer with Response.Redirect, all relative
references are ok.
Can someone shed some light on this problem of mine and tell me what i have
done wrong?
Any help is greatly appreciated.
KD

Nov 19 '05 #3
Thanks TDAVISJR. I tried replacing the .. with ~/level1/level2/page1.aspx but
it still doesn't work. I found out something quite peculiar, may be it's by
design? What I have found was, with the Server.Transfer method, only the
parent-child relationship can be maintained. That is, it's OK to navigate
from the Root (parent) to the next level (child) and back, then the root
remains the same. However, if you go from the Root to Level1, then to Level2
as in:
Root
Level1
Page1.aspx
Level2
Page2.aspx
To Page1.aspx, its virtual root now becomes Level1 (instead of the actual
Root). As a consequence, if you navigate from Page2.aspx back to a page under
the actual Root directory, all references are now out of synch. It's quite
bizarre and frustrating to say the least.
As a consequence, I can't use the HttpContext.Current.Items collection to
maintain my Session variables (as it only work with Server.Transfer, not
Response.Redirect).
Can someone prove me wrong here? I'm more than happy if this isn't the case.

KD

"TDAVISJR" wrote:
Instead of using the .../. Use the ~ to say go to the root directory.

Server.Transfer("~/secure/Welcome.aspx");

--
TDAVISJR
aka - Tampa.NET Koder
"Calvin KD" <Ca******@discussions.microsoft.com> wrote in message
news:CC**********************************@microsof t.com...
Hi everyone,
I don't know if there's anyone out there is having the same problem. My
DotNet 1.1 version uses FormsAuthentication.RedirectFromLoginPage() method
to
take user from the Login page to the Welcome page. My folder structure is
as
follows:
Root Dir
bin
images
secure
Welcome
Folder1
Page1
Folder 2
Page 2
login
stylesheet
web.config

To navigate to other pages within the application, Server.Transfer()
method
seems to lose its node's coordinates relative to the whole tree structure.
For example, the Welcome page references the stylesheet as
../stylesheet.css
and Page1's reference is ../../stylesheet.css. When I used Server.Transfer
method to go to Page1 from Welcome page, Page1 cannot find the stylesheet.
However, if I replace Server.Transfer with Response.Redirect, all relative
references are ok.
Can someone shed some light on this problem of mine and tell me what i
have
done wrong?
Any help is greatly appreciated.
KD


Nov 19 '05 #4

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

Similar topics

6
by: \A_Michigan_User\ | last post by:
Ok, I give up... why do 1-4 work fine... but 5-6 give "can't find" errors? 1. Client-side VBscript code: call navigate("\\209.11.22.33\MyDir") 2. Client-side VBscript code: location.href...
6
by: StephenMcC | last post by:
Hi All, Got a quick query in relation to the Server.Transfer method available in IIS 5+/ASP. I've got an issue where I want to take a portion of an online app and extract this out into a web...
3
by: Justin | last post by:
Hi, Im confused here over the usage of Response.Redirect and Server.Transfer. I used frameset for my work, what are the proper usages of the two methods that seems working similar.. The...
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...
5
by: Julien C. | last post by:
Hi all, I have an "EditeItem.aspx" page which lets me edit properties of an "Item". In the OnClick() event of my Save button, I do save Item changes to the database and then I redirect the user...
8
by: Cathie | last post by:
Hi guys, I want to do a Server.Transfer to get to a second page, so that I may retrieve variables I have set in the first page. I'm doing that with the usual Server.Transfer("pagename", true). ...
3
by: Alan Silver | last post by:
Hello, Sorry if this is a stupid question, but I can't really see much difference between these tow methods according to the scant info in the SDK. Could anyone enlighten me? TIA -- Alan...
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...
9
by: RN1 | last post by:
When a server encounters the line Response.Redirect("abcd.asp") in a ASP script, the server tells the browser that it has to be redirected to another page (which is abcd.asp, in this case)....
3
by: jasonheath.net | last post by:
I apologize in advance for the length of this post. I wanted to get as much detail as possible in here. We have 1 web app that contains the functionality to do some single sign-on logic. The...
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:
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...
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:
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
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...

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.