[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Retriving session ID from one web application and passing to other application

Posted on 2006-05-08
7
Medium Priority
?
428 Views
Last Modified: 2010-04-17
I have one web application in .net. Upon the login to this application it
creates a session ID.

I Want to use this session id created by this application in other web application.

How do I retrive and pass the session id to other application.

Pls Help.
0
Comment
Question by:r_pat72
  • 3
5 Comments
 
LVL 3

Accepted Solution

by:
yokkui earned 1000 total points
ID: 16635686
The simplest way is to use Http Post or Http Get to pass it along when calling a page in the other application.

How to retrieve it? You can get it from Session.SessionID.
0
 
LVL 2

Expert Comment

by:barisgomlek
ID: 16637645
You can create a list (an ArrayList) that holds all the current sessionID's and save it to Application["SessionArrayList"]. Then all your clients can access this list.

If you want only one session ID, you do not need a list.
0
 
LVL 2

Expert Comment

by:barisgomlek
ID: 16637652
If they are completely different applications, you can send it by querystring to other application:

Response.Redirect("http://www.otherwebsite.com/default.asp?sessionid=" & Session.SessionID)
0
 

Author Comment

by:r_pat72
ID: 16640351
The application that setting specifically session id in cookie. I don't have access to the code of that application but i can login to that application using user id and password.

When I login to that application it sets the seeionid in a cookie as response["sessioid"] = "xxxx"

How will I read that session ID from cookies in my application.

I did request["cookies"].But it doesn't return anything.
0
 
LVL 2

Assisted Solution

by:barisgomlek
barisgomlek earned 1000 total points
ID: 16641910
public static HttpCookie GetCookie(string key)
            {
                  //encode key for retrieval
                  key = HttpContext.Current.Server.UrlEncode(key);
                  return HttpContext.Current.Request.Cookies.Get(key);
            }

            public static string GetCookieValue(string key)
            {
                  string value = "";
                  try
                  {

                        //get value
                        HttpCookie cookie = GetCookie(key);
                        if (cookie != null)
                        {
                              value = cookie.Value;
                              //decode stored value
                              value = HttpContext.Current.Server.UrlDecode(value);
                        }
                  }
                  catch (Exception ex)
                  {
                        string e = ex.Message;
                  }
                  return value;
            }

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Make the most of your online learning experience.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Six Sigma Control Plans

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question