Server.Transfer

  • Thread starter Thread starter Charlie Dison
  • Start date Start date
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?
 
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
 
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
 
Back
Top