473,324 Members | 2,356 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,324 software developers and data experts.

Request.QueryString and "&" in Folder Name

Not sure where to ask this question, but...
I'm using a TreeView component to enable browsing file folders in a
specific directory (for test purposes /Program Files/). Some users use
an ampersand ("&") in both folder and file names. This has caused me
some real grief! I'm not in a position to tell the users it's an ID 10
T error and they have to change their file and folder names.
In VS2K5, I have debugged my code and found that

sender.base.Request.QueryString =
{dir=%2fProgram+Files%2fMom+&amp%3b+Pop%2f}

and

sender.base.Request.RawURL="/popups/share_directory/XmlFromFileSystem.aspx?dir=/Program%20Files/Mom%20&%20Pop/"

These results reflecting a file folder /Program Files/Mom & Pop/

However, the code line:

sdir = Request.QueryString["dir"]

gives me /Program Files/Mom (space after Mom is included). In other
words, everything from the ampersand on, including the ampersand, is
truncated. The "&amp%3b" you see in the QueryString is my attempt to
escape the ampersand. I've also tried /& to no avail.

At this point, the boss thinks I'm a loser! Any help would be greatly
appreciated!
Asp.NET 2.0, VS 2005.
Randy

May 8 '06 #1
1 2896
Just use URLencode when you generate the url ...
http://msdn2.microsoft.com/en-us/lib...6w(VS.80).aspx you can
urldecode it when you get it back. It supports amspersands without issue.

Cheers,

Greg
"EoRaptor013" <rc*******@patmedia.net> wrote in message
news:11**********************@y43g2000cwc.googlegr oups.com...
Not sure where to ask this question, but...
I'm using a TreeView component to enable browsing file folders in a
specific directory (for test purposes /Program Files/). Some users use
an ampersand ("&") in both folder and file names. This has caused me
some real grief! I'm not in a position to tell the users it's an ID 10
T error and they have to change their file and folder names.
In VS2K5, I have debugged my code and found that

sender.base.Request.QueryString =
{dir=%2fProgram+Files%2fMom+&amp%3b+Pop%2f}

and

sender.base.Request.RawURL="/popups/share_directory/XmlFromFileSystem.aspx?dir=/Program%20Files/Mom%20&amp;%20Pop/"

These results reflecting a file folder /Program Files/Mom & Pop/

However, the code line:

sdir = Request.QueryString["dir"]

gives me /Program Files/Mom (space after Mom is included). In other
words, everything from the ampersand on, including the ampersand, is
truncated. The "&amp%3b" you see in the QueryString is my attempt to
escape the ampersand. I've also tried /& to no avail.

At this point, the boss thinks I'm a loser! Any help would be greatly
appreciated!
Asp.NET 2.0, VS 2005.
Randy

May 8 '06 #2

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

Similar topics

23
by: ian justice | last post by:
Before i post actual code, as i need a speedyish reply. Can i first ask if anyone knows off the top of their head, if there is a likely obvious cause to the following problem. For the moment i've...
3
by: Arpan | last post by:
A link has the following URL: <a href="Page1.asp?cname=<%= Request.QueryString("cname") %>&cadd1=<%= Request.QueryString("cadd1") %>&cadd2=<%= Request.QueryString("cadd2") %>&cplace=<%=...
3
by: 21novembre | last post by:
Hi all, I made a question several days before to describe my strange trouble of mysqldump. But I still can't figour it out. Well, I just want to ask another question whether I could just backup...
4
by: barney | last post by:
Hello, I' m using .NET System.Xml.XmlDOcument. When I do the following: XmlDocument xml = new XmlDocument(); xml.Load("blah"); .... xml.Save("blub"); I've got the problem that the following...
5
by: martin | last post by:
Hi, I would be extremly grateful for some help on producing an xml fragemt. The fragment that I wish to produce should look like this <Addresses> <Address>&qout;Somebody's Name&quot;...
2
by: Mehdi | last post by:
Hi, I need to pass an URL via a hidden value as follow: <input type="hidden" id="Test" runat="Server"> and on Page_Load I assign a value to this hidden input as follow: Test.Value =...
2
by: beachboy | last post by:
I have a problem if the parameter has a "&" symbol in querystring, i think asp.net will split the value into 2 values as "&" is a spliter any advise can give me to solve this problem? P.S. I...
1
by: EoRaptor013 | last post by:
Not sure where to ask this question, but... I'm using a TreeView component to enable browsing file folders in a specific directory (for test purposes /Program Files/). Some users use an ampersand...
3
by: Tanmaya Kulkarni | last post by:
Hi, I need to pass a string having ampersand "&" in the query string like Company=Johnson&Johnson. How do I send it and receive it? TIA, Tanmaya
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.