.net query string

we have to call a query string like default.aspx?id=1&address=1000 main street. #1000

and when we called like string address = request.querystring["address"], we only get 100 main street.

How can we get the whole address?
LVL 1
ITsolutionWizardAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dameyCommented:
On the client side you'll have to encode the query string and decode it on the server before parsing it.

EXAMPLE:
<javascript>
//client side
//called by the onSubmit;
 function encodeURL(requeststring)
{
   encodeURI(requeststring)
    //encodeURI("default.aspx?id=1&address=1000 main street. #1000");
}
</javascript>

//SERVER SIDE

string address = HttpContext.Current.Server.UrlDecode(HttpContext.Current.Request.QueryString["address"].ToString());
0
Rose BabuSenior Team ManagerCommented:
If you can change the original url as below while redirecting
Response.Redirect("~/Default.aspx?id=1&address=" + Server.UrlEncode("1000 main street. #1000"));

Open in new window

then you can parse that as below
Label1.Text   = Server.UrlDecode(Request.QueryString["address"]);

Open in new window

0
ITsolutionWizardAuthor Commented:
not working from both solutions
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

dameyCommented:
Post your code from client and server, should work, must be an order of calls issue.
0
ITsolutionWizardAuthor Commented:
If I do not add "#", everything is working. But if I add "#", it shows nothing.

Thanks
7-24-2015-5-33-48-PM.jpg
result.jpg
0
dameyCommented:
OK when are you encoding the url ?
encodeURI(requeststring)?
show us some results frome both sides i.e. debug.print
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.