Click here to Skip to main content
15,884,473 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello
how can I pass hidden parameter through the URL in ASP.NET and C#
I want to pass three params two of them are not hidden and one of them is hidden
so the URL looks like
...............?p1=val1 &p2=val2
but it actually contains p3=val3
thanks all
Posted

Query (GET) parameters are always urlencoded and passed as cleartext, independent of the type of the field. POST parameters are not passed in the query, they are encoded in the request body, as well as the COOKIEs.
You can even "combine" them, by using query parameters in a post request.
So you can not actually hide any field, only move it to the request body, thus it will be not so obvious, but can be easily found by anyone having some http knowledge.

You can encrypt the query string, but that is no real encryption of the traffic, needs a little more knowledge to crack, but can hinder many from seeing the values passed. See this one for example: http://madskristensen.net/post/HttpModule-for-query-string-encryption.aspx[^] (but there are more approaches like this out there...)
 
Share this answer
 
v2
Hi,

I think you want to hide your 3rd parameter for the security reason. But why you depend on passing parameter? you can even use Session/Cache/Cookies/Store in any hidden field and get it using Page.PreviousPage.

You can send request with either GET/POST, mixing of request is not possible. So i suggest you to use one of the method i have mention above.

Thanks
-Amit Gajjar
 
Share this answer
 
Hi,

Even if I do not understand the purpose of using hidden value, you can
use hidden Fields and Query Strings solve the purpose.
HTML
<input type="hidden" value="Value That You Need to Store" id="KeyName">

in the target page use the following code to access this field value.
C#
String strValue = Request.Params["KeyName"];

Thanks!!!!!
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900