locked
Retrieve values after response.redirect RRS feed

  • Question

  • User229990480 posted

    Hi everyone,

    I have a question in which I can use your knowledge. :) Because I can't see it.

    I am creating a call to a webservice and after that call I get a sessionId.

    After I recieve the sessionId, I need to do a redirect to a other page of the supplier.

    Then I immediatly get redirected back to my own page and the session is confirmed.

    The only thing a need is the sessionId which I send in the first request to be redirected.

    Is there a way in the code to use the sessionId again in the page after I get redirected.

    How can I pass this value from one page to the other, with a visit to the supplier website in between?

    Friday, August 26, 2011 7:34 AM

Answers

All replies

  • User699558600 posted

    I will suggest you to pass it in url...

    e.g. http://othersite.com/supplier.aspx?sessionID=123456789

    if session id is very secure you can encrypt or encode it...

    from other page of the supplier you can do same thing...redirect back to your site with same session Id

    e.g. http://mysite.com/myPage.aspx?sessionID=123456789

    Friday, August 26, 2011 8:03 AM
  • User229990480 posted

    Hi, thanks

    This sounds good.

    Do you have a example link with code for me?

    regards

    :-D

    Monday, August 29, 2011 2:21 AM
  • User2115259052 posted

    As I understand, your scenario is as below:

    Your Page --> WebSerivce --> Your Page (SessionID) --> SupplierPage (SessionID) --> Your Page.

    You can store the SessionID in a Session Variable and read it back when the supplier page redirects to Your Page.

    Session["MySessionID"] = SessionID;
    //Call Supplier Page

    protected void Page_Load(object sender, EventArgs e)
    {
    if(Session["MySessionID"]!=null)
    {
    //Retreive SessionID and perform work
    Session["MySessionID"] = null;
    }
    }
    Monday, August 29, 2011 8:22 AM
  • User229990480 posted

    Hi thank you for your response, but this won't work, because of the redirect I leave the server and the session will be lost.

    Is there any other way?

    regards

    Tuesday, August 30, 2011 9:17 AM
  • User-1177472553 posted

    1)better use cookies for that purpose as they get stored on client's PC...

    and do remember that the name of cookie must be the same in both of ur applications ....

     

    Wednesday, August 31, 2011 5:36 AM
  • User2115259052 posted

    because of the redirect I leave the server and the session will be lost

    If you are using cookie based session I dont think your session will be lost (unless in some special scenarios).

    Use  

    Response.Redirect("URL", false);

    to be on the safer side! Try out and let me know what you find!

    Wednesday, August 31, 2011 6:06 AM