Server.Transfer

C

Charlie Dison

Hi There,
I would like to be able to arrange my asp.net pages into different
directories. This causes a problem though because successfully transferring
to a page depends on where you are currently at. For example if the page
I'm redirecting from is in the root directory, transferring to a page in the
xyz directory would look like this: Server.Transfer("xyz\thepage.aspx"). If
I'm in the ABC directory I'd need to do something like this:
Server.Transfer("../xyz/thepage.aspx"). Is there a way for me to get
around this?
 
B

Bryant Hankins

Charlie,
You can use the tilde "~" which always maps to the application root.
So in your example below you could always use
Server.Transfer("~/xyz/thepage.aspx") no matter what your current context
is.

HTH,
-Bryant
 
C

Charlie Dison

Thanks Bryant, thats what I'm looking for.

Bryant Hankins said:
Charlie,
You can use the tilde "~" which always maps to the application root.
So in your example below you could always use
Server.Transfer("~/xyz/thepage.aspx") no matter what your current context
is.

HTH,
-Bryant
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,244
Latest member
cryptotaxsoftware12

Latest Threads

Top