2

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.

1

2 Answers 2

5

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];
Sign up to request clarification or add additional context in comments.

7 Comments

can you please give me an example(if possible even a rough one)?
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?
@TMcKeown Looks like you got denied your points. I'll upvote you for good answer. +1 :-)
Yeap +1 the answer was good. Hope the op will appreciate it too!
@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!
|
0

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

the code will be deployed in load balanced servers, so cannot use session.
Shared session can be implemented though.
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.