Click here to Skip to main content
15,917,568 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

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:[^] (but there are more approaches like this out there...)
Share this answer

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.

-Amit Gajjar
Share this answer

Even if I do not understand the purpose of using hidden value, you can
use hidden Fields and Query Strings solve the purpose.
<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.
String strValue = Request.Params["KeyName"];

Share this answer

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