472,958 Members | 2,232 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

How to enforce "&"inside my queryString?

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";
However when I view the page source "&" is replaced with "&amp;" as the URL
changes to http://www.myserver.com?id=123&amp;name=HomerSimpson

How can I enforce the "&" inside my querystring when written into HTML?

I have tried to Server.UrlEncode, but the server that I am posting this
hidden value to, does not decode it before returning to the URL, and
unfortuntely I have no control over the way that they handle my hidden value
(URL with &amp;)

Thanks for your time.
Mehdi

Nov 19 '05 #1
2 1589
You might be able to resolve this by writing out the entire value to an
<asp:Literal> control, e.g.

<asp:Literal id="TestLiteral" runat="Server">

TestLiteral.Text = String.Format (
@"<input type=""hidden"" value=""{0}"" id=""Test"" runat=""Server"">",
@"http://www.myserver.com?id=123&name=HomerSimpson"
);

"Mehdi" <no****@nospam.nowhere> wrote in message
news:u7**************@TK2MSFTNGP14.phx.gbl...
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";
However when I view the page source "&" is replaced with "&amp;" as the URL changes to http://www.myserver.com?id=123&amp;name=HomerSimpson

How can I enforce the "&" inside my querystring when written into HTML?

I have tried to Server.UrlEncode, but the server that I am posting this
hidden value to, does not decode it before returning to the URL, and
unfortuntely I have no control over the way that they handle my hidden value (URL with &amp;)

Thanks for your time.
Mehdi


Nov 19 '05 #2
MWells,

You were right, it enforces the "&" inside my query string.

Thanks
Mehdi
Nov 19 '05 #3

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

Similar topics

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=<%=...
1
by: David Furey | last post by:
Hi I have an XML documnet and a XSLT document as shown below THe XSLT document brings back a filtered docmument that has the VendorName that starts with a particular sub-string This works as...
0
by: Martin Maurer | last post by:
Hello, i have a problem with NameValueCollection.Add or better with converting to a QueryString: NameValueCollection myQueryStringCollection = new NameValueCollection();...
5
by: chortler | last post by:
When I use the meta tag to refreh my asp webpage, it doesn't change Ispostback to false; It always equals true? Any ideas??
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
2
by: Me | last post by:
I am passing on the input name to my asp page using Response.redirect "mypage.asp?name=" & name and the resulting url looks like 'companyname/mypage.asp?name=" & name I would like it to appear...
30
by: Medvedev | last post by:
i see serveral source codes , and i found they almost only use "new" and "delete" keywords to make they object. Why should i do that , and as i know the object is going to be destroy by itself at...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

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.