FluxEngine
FluxEngine

Reputation: 13290

Passing a Session Variable via a URL (ASP.Net)

I have an aspx page, which is a "User Log-In" area. I want to pass the userid to another page which is linked from the aspx page.

the link I have looks something like this:

www.abcdefg.com/Home/Redirect/?authtkn=123456abcd=xxxx

I need the xxxx to be a session variable which in this case is userid.

**userid is not sensative information, this is simply to redirect the user to another page for specified information.

Any thoughts on how to pass a session variable to a URL, or if this can be done. The example www.abcdefg.com is a different domain (on a different server) from the original aspx page.

Upvotes: 0

Views: 3707

Answers (3)

cursesNOOB
cursesNOOB

Reputation: 11

You don’t need to pass a session variable via the url. You can just start session on the next page and have access to all your session variables! If you do want the variables up there so you can quickly get to different userids with just a quick url change, send userid to the url on your previous page with with $_GET[ ].

Upvotes: 0

ValidfroM
ValidfroM

Reputation: 2817

Think your question is how to maintain cross domain session or authentication. Check this link Maintaining Session State Across Domains, may give you some idea

Or this one How can I share a session across multiple subdomains?

Upvotes: 2

hackp0int
hackp0int

Reputation: 4161

Why not appending like this?

string.Format("www.abcdefg.com/Home/Redirect/?authtkn=123456abcd={0}", 
    Session["UserId"]);

if i understood you correctly.

Upvotes: 3

Related Questions