473,385 Members | 1,676 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,385 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 2900
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...

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.