Am in the process of performing SSO for all apps in a domain
Things i have done so far are
- Created a parent site with form authentication where login is performed
- Removed the authentication mode of all child applications to none
- Added a handler in all child apps checking if user authenticated and fetch user details for the app
Code for handler is as follows
public class MyHandler : IHttpHandler, IRequiresSessionState
{
public bool IsReusable
{
get { return true; }
}
public void ProcessRequest(HttpContext context)
{
if (context.Request.IsAuthenticated)
{
if (context.Session["UserDetails"] == null)
{
string userName = HttpContext.Current.User.Identity.Name;
UserManagement userMngmt = new UserManagement();
userMngmt.GetLoggedUserDetails(userName);
// context.Response.Redirect(context.Request.Url.ToString(), true);
}
}
else
{
context.Response.Redirect("/SSO");
}
}
}
The idea is if he is authenticated get user name and get his details and store in session and proceed to load the requested page with the user details.
But now the page is not getting loaded. I understood that after checking i have to load the page requested.How to do so.