When you use a back-slash in a C# string it will not always be considered as a back-slash. The back-slash has special meaning as in many other programming languages; e.g. if you write
\n it means new line. Perhaps this will help...
http://www.google.dk/search?hl=en&q=...e+character%22
Anyways, you can do it in three ways...
1. The first way is probably the most elegant way to do it. You can put an 'at' in front of a string and the C# compiler will ignore the escape character ('\') in the string.
Code:
Response.Redirect(@"somefolder\nice.aspx");
Notice that the first letter after the back-slash is 'n' which would normally render a new line.
2. The second way is the older version; you use a back-slash to escape the back-slash. Simply replace all back-slashes with two.
Code:
Response.Redirect("somefolder\\nice.aspx");
3. The third way is a little bit political. When developing applications for
Windows it is OK to use back-slash, but some would say that this is wrong. Forward slash will
AFAIK work on
Windows and it will also work on
Linux.
Code:
Response.Redirect("somefolder/nice.aspx");
This issue is causing some portability issues; i.e. if you are using back-slash in paths you will not be able to run the application - possibly web application - on
Linux.
Hope it helps,
Jacob.