473,749 Members | 2,463 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Server.Transfer vs Response.Redire ct

Hi everyone,
I don't know if there's anyone out there is having the same problem. My
DotNet 1.1 version uses FormsAuthentica tion.RedirectFr omLoginPage() 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.Redire ct, 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 2810
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******@discu ssions.microsof t.com> wrote in message
news:CC******** *************** ***********@mic rosoft.com...
Hi everyone,
I don't know if there's anyone out there is having the same problem. My
DotNet 1.1 version uses FormsAuthentica tion.RedirectFr omLoginPage() 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.Redire ct, 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.serverv ariables( "script_nam e" ) will return "default.as p" 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 FormsAuthentica tion.RedirectFr omLoginPage() 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.Redire ct, 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.Cur rent.Items collection to
maintain my Session variables (as it only work with Server.Transfer , not
Response.Redire ct).
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******@discu ssions.microsof t.com> wrote in message
news:CC******** *************** ***********@mic rosoft.com...
Hi everyone,
I don't know if there's anyone out there is having the same problem. My
DotNet 1.1 version uses FormsAuthentica tion.RedirectFr omLoginPage() 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.Redire ct, 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
4561
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 ="\\209.11.22.33\MyDir" 3. Typing "\\209.11.22.33\MyDir" into my ie6 browser. 4. Typing "\\209.11.22.33\MyDir" into my Windows Explorer. 5. Server-side ASP: server.transfer "\\209.11.22.33\MyDir" 6. Server-side ASP: response.redirect...
6
2237
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 site on its own, so I will end up having two web sites. This planned to aid problems we've been having with performance, as if the portion (which is an app in its own right) has problems we then have to restart the whole site and so bring everything...
3
9080
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 problem i faced while using Response.Redirect is that the page that is directed to, does not looks as desired..the textboxes are not visible anymore and so as
4
2115
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 Response.Redirect("URL") or a Server.Transfer("URL"). So I'd like to find out which is more efficient/better. Can anyone please tell me or give any pointers to links on the web? Thanks & Regards
5
7828
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 to the Item page "ViewItem.aspx" with a simple : Server.Transfer("ViewItem.aspx"); I'd like to pass another HTTP parameter so that in the "ViewItem.aspx" page,
8
3786
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). My problems are as follows: 1. On the initial load everything seems to be referencing from the first page. For example, my style sheet I reference using "../../styles.css" but it seems to need "../styles.css" as the first page is one step...
3
5507
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 Silver
8
3900
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 need to avoid the extra round-trip to the client. I've tried Passing the page name, the full URL, and the instance of the handler class to the Transfer method, but everything gets me the same error 500. Any help would be appreciated.
9
4347
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). The browser then makes a new request to the server to redirect itself to abcd.asp after which the user gets redirected to abcd.asp. But in case of Server.Execute (or Server.Transfer), when the server
3
3539
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 flow is 1. Welcome page 2. Login Page (where the SSO actually occurs) 3. Welcome page 4. Default page
0
8832
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9566
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9333
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9254
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4608
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3319
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.