I am using the openid-selector with DotNetOpenAuth in my MVC 3 app. Whenever I set a session variable and the DotNetOpenAuth sections are in the web.config, my session variables don't stick after a redirect.
I checked the Session.SessionID variable and it is still the same, so I am in the same session (I believe), but when I check the session variables I just set after a redirect they are all set to null.
I haven't seen anyone else with this issue. I am wondering if DotNetOpenAuth just isn't ready for MVC 3 yet. I am using the latest version of DotNetOpenAuth as well.
Here are the relevant portions of the web.config if it helps:
<configSections>
<section name="uri" type="System.Configuration.UriSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<section name="dotNetOpenAuth" type="DotNetOpenAuth.Configuration.DotNetOpenAuthSection" requirePermission="false" allowLocation="true"/>
</configSections>
<uri>
<idn enabled="All"/>
<iriParsing enabled="true"/>
</uri>
<system.net>
<defaultProxy enabled="true"/>
<settings>
<servicePointManager checkCertificateRevocationList="true"/>
</settings>
</system.net>
<dotNetOpenAuth>
<openid>
<relyingParty>
<security requireSsl="false"/>
<behaviors>
<add type="DotNetOpenAuth.OpenId.Behaviors.AXFetchAsSregTransform, DotNetOpenAuth"/>
</behaviors>
</relyingParty>
</openid>
<messaging>
<untrustedWebRequest>
<whitelistHosts>
<add name="localhost"/>
</whitelistHosts>
</untrustedWebRequest>
</messaging>
<reporting enabled="true"/>
</dotNetOpenAuth>
Updated:
it is happening on my development server, either in IIS, or when I run the ASP.NET development server.
Also, I tried running session in process and out of process using the state server, and it didn't make a difference.
In regards to a new session, I checked the session_start event, and that isn't being called. I also checked the Session.IsNewSession, and that returned false as well. So something is randomly (or maybe not so randomly) deleting my session variables!
Found the issue here (long ago now). Apparently MVC2 didn't care if I had a view for my actions where I just did some processing then a redirect.
However starting in MVC3, after my upgrade, if I didn't have a view for my action, the page registered an error, and once there was an error, the framework did not store the session variables I just set.
So simple fix... add the views and then also make sure there are no errors in the views.