I'm developing an ASP.NET MVC application (targetFramework 4.5) that provides user to login to the site using Custom Authentication as well as using their Twitter account. The following libraries have been referenced
- Microsoft.Owin
- Microsoft.Owin.Host.Security
- Microsoft.Owin.Security
- Microsoft.Owin.Security.Cookies
- Microsoft.Owin.Security.MicrosoftAccount
- Microsoft.Owin.Security.OAuth and
- Microsoft.Owin.Security.Twitter
When I click the twitter button in my web page, it takes to the twitter site, gets my credentials and back to my site. No issues here.
i 'm now integrating RedisSessionStateProvider.cs for managing session using Redis. I have added the provider file (RedisSessionStateProvider.cs) and I have updated the web.config file as follows:
<sessionState cookieless="false" customProvider="RedisSessionStateProvider" mode="Custom" timeout="20">
<providers>
<add name="RedisSessionStateProvider" port="6379" server="localhost" type="RedisProvider.SessionProvider.CustomServiceProvider" writeexceptionstoeventlog="true" />
</providers>
</sessionState>
Redis server is running and is listening on port 6379. Now if I click the Twitter button, the site takes me to the twitter authentication page and after successfully authenticating from twitter, when the callback method
public async Task ExternalLoginCallback(string returnUrl)
is fired, the code
await AuthenticationManager.GetExternalLoginInfoAsync();
is returning null.
If I comment out the sessionstate node from the config file, everything is working fine i.e. the GetExternalLoginInfoAsync() is returning the loginInfo correctly.
I'm not able to identify the root cause of this issue. Can anyone please guide me in addressing this issue?
Thanks, Hemant.