tags:

views:

367

answers:

4

From what i understand session cookies are serverside and not transmitted to the user at all. This means it is safe from tampering (from outside of the server)?

Anyways, from what i can tell POST data is stored in HttpContext.Current.Request.Form. How do i get GET data?

right now i am doing this

            HttpContext.Current.Session.Clear();
            foreach (var v in HttpContext.Current.Request.Form)
                HttpContext.Current.Session.Add(v, HttpContext.Current.Request[v]);

Other then needing to be careful when clearing my session data is this code a good idea or bad idea? I am trying to solve this problem http://stackoverflow.com/questions/1073094/can-i-hold-post-data-in-asp-net-so-i-can-verify-with-captcha

+1  A: 
foreach (var v in HttpContext.Current.Request.QueryString)
Christian Hayter
A: 

You can get GET data from the querystring HttpContext.Current.Request.QueryString

dnoxs
A: 

A session cookie IS transmitted to the browser. That browser then resends that cookie with every request - that is how the server knows the requests belong to the same Session.

The Session data however is kept only on the server, nothing about that is transmitted to the client.

Hans Kesting
A: 

How do i get GET data?

Hiya,

To access GET data you need to look inside Request.Params

Here's some sample code to demonstrate usage.

//get the param with the requested name
string paramValue = Request.Params["paramName"];
DoctaJonez