Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
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 1-Sep-12 5:01am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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...)
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hi,
 
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"];
Thanks!!!!!
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 499
1 Nirav Prabtani 338
2 OriginalGriff 175
3 _Amy 170
4 PIEBALDconsult 160
0 OriginalGriff 7,640
1 Sergey Alexandrovich Kryukov 6,836
2 Maciej Los 3,919
3 Peter Leow 3,698
4 CHill60 2,742


Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 1 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100