473,586 Members | 2,566 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Request.QuerySt ring 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.Req uest.QueryStrin g =
{dir=%2fProgram +Files%2fMom+&a mp%3b+Pop%2f}

and

sender.base.Req uest.RawURL="/popups/share_directory/XmlFromFileSyst em.aspx?dir=/Program%20Files/Mom%20&%20P op/"

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

However, the code line:

sdir = Request.QuerySt ring["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 2917
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
"EoRaptor01 3" <rc*******@patm edia.net> wrote in message
news:11******** **************@ y43g2000cwc.goo glegroups.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.Req uest.QueryStrin g =
{dir=%2fProgram +Files%2fMom+&a mp%3b+Pop%2f}

and

sender.base.Req uest.RawURL="/popups/share_directory/XmlFromFileSyst em.aspx?dir=/Program%20Files/Mom%20&amp;%20P op/"

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

However, the code line:

sdir = Request.QuerySt ring["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
5657
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 reduced my form request to a simple text string entry, instead of my desired optional parameters. As i have been stuck with a single unfathomable...
3
17281
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=<%= Request.QueryString("cplace") %>">Click</a> Suppose the names in the above querystring have the following values: cname="Danny" cadd1="House 97"
3
4688
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 my databases by copying the data folder to some place? Then if I meet some disaster, could I just copy the backup folder back to recover my...
4
14776
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 expression: .... snip ...
5
3427
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; &lt;me@mydomain.com&gt;</Address> </Addresses>
2
1620
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 = "http://www.myserver.com?id=123&name=HomerSimpson";
2
2549
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 can't restrict user don't input "&" symbol when input Thanks in advanced.
1
335
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 ("&") 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...
3
1531
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
7912
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7839
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8202
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8338
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8216
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5710
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3865
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.