I am working for a project which has web garden scenario and cannot keep any data in session/inmemory. The asp.net page opens from Appian(bpm tool) and we pass id through query string. Now, client is asking me to hide the query string parameter after reading it. But, in that case say, landing page is http://a.aspx?id='123' and after reading that value we have to redirect to b.aspx without exposing the id(query string). Please suggest me a suitable way to achieve this. I am not really getting any idea for this.
2 Answers
you can add key/value pairs to the header, it won't be visible in the querystring.
HttpContext.Current.Response.Headers.Add( key, value);
and
string headerVal = HttpContext.Current.Request.Headers[key];
7 Comments
rahulsen002
can you please give me an example(if possible even a rough one)?
rahulsen002
The code will be deployed in multiple servers in load balanced scenario.So, say first request is sent to server A, where you set the key value pair and the second request will be sent to server B, where it will not get the value set in the httpcontext. Can this scenario arise in this case?
Rick S
@TMcKeown Looks like you got denied your points. I'll upvote you for good answer. +1 :-)
Athanasios Kataras
Yeap +1 the answer was good. Hope the op will appreciate it too!
rahulsen002
@TMcKeown i am new here and it says i need to have 15 reputations to vote up. :( But your advice was great and it works too!
|
You can use session variables on the server side or http Post instead of GET.
Session["id"] = id;
And on load of b retrieve it.
To use Post you can use a hidden field and a form.
//You can set it like this
<form name='IdForm' action='b.aspx' method='post'>>
<asp:HiddenField id="WhateverId" runat="server" value='<%= Request.QueryString["whateverID"] %>' />
</form>
On redirect use javascript to post
function Redirect() {
document.forms["IdForm"].submit();
}
You must use this js script wherever the redirection happens.
And finally on b.aspx code behind
HttpContext.Current.Request.Form["WhateverId"]
3 Comments
rahulsen002
the code will be deployed in load balanced servers, so cannot use session.
Athanasios Kataras
Shared session can be implemented though.
Athanasios Kataras
You can also load balance the servers by user session and not by request. Your performance drop will be virtually non-existent and you will be able to use Session. Only drawback here is that if one server fails your user must re-login