Click here to Skip to main content
14,449,862 members
Rate this:
Please Sign up or sign in to vote.
See more:
I am trying to implement OAuth in my application.
On login page, I am setting a session varible with some string value.
Session["CompanyInfo"] = "Your Company Name";

I then redirect to the ADFS login page where I enter correct user name and password.
After successful authentication, it redirects me to another page in my application where I am trying to access the session variable I stored earlier.

But here, I am getting session value null.
string comapny = Convert.ToString(Session["CompanyInfo"]);
//Session value is null here

Any suggestions on this appreciated.


What I have tried:

I tried passing querystring parameter while redirecting to ADFS. Then after ADFS login, back on another page in application, tried to get that value using UrlReferer.
This worked on my local machine but not on production.
UrlReferer was blank on production server.
Updated 10-Feb-20 2:47am
F-ES Sitecore 23-Feb-17 11:29am
Does the entire process happen in the same browser tab? Or is the login spawned in a new tab or the return in a new tab? Also do you return back to the exact same site, not changing http for https, not changing a domain to a sub-domain and so on?
Lokesh Zende 24-Feb-17 0:50am
Yes, the entire process happens in the same domain, in the same browser tab.
Its kind of weird, I get the session values sometimes but not always.
Member 14740308 11-Feb-20 2:59am
Hello Lokesh,

Did you find any solution for this issue?

Please let me know

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100