Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to logout from all the opened web applications through the logout button in the portal?

I i use the post method to open different web sites through my portal like this :

In my portal main page :

<form method="post" target="_blank" action="">
<input id="Hdn_r" name="Hdn" type="hidden" value="55622"> 
.....
</form>

then in the main page of any site opened through the portal i do the following check :

var hr = HttpContext.Current.Request.UrlReferrer;
        if (hr != null && !string.IsNullOrEmpty(hr.AbsolutePath))
        {
            if (Request.UrlReferrer.AbsolutePath.Contains("Portal"))
            {

                if (Request.Form["Hdn_r"] != null && !string.IsNullOrEmpty(Request.Form["Hdn_r"].ToString())
                   && Request.Form["Hdn_a"] != null && !string.IsNullOrEmpty(Request.Form["Hdn_a"].ToString()) &&
                   Request.Form["Hdn_b"] != null && !string.IsNullOrEmpty(Request.Form["Hdn_b"].ToString()) &&
                   Request.Form["Hdn_c"] != null && !string.IsNullOrEmpty(Request.Form["Hdn_c"].ToString())
                   )
                {

                  Session["emp_num"]= int.Parse(Request.Form["Hdn_r"].ToString());
                //...........

My question is :

How to logout from all the opened web sites through one click in the logout button in my portal ?

Say i open three web sites through my portal , i want when i logout(in the portal) to log me out from all the opened applications ?

Note: the different web sites in the portal published in different servers .

like image 921
Anyname Donotcare Avatar asked Jan 19 '14 12:01

Anyname Donotcare


2 Answers

Create a logout page in all your websites. Then, when you want to logout, call those logout pages with ajax. Or make httprequests to that logout pages. You cannot logout directly because they are not on same domain and one site cannot alter session of another site.

like image 69
Kuzgun Avatar answered Oct 11 '22 13:10

Kuzgun


Why don't you try making the right POST requests targeting all you websites, in order to loggout programmatically ?

See http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest(v=vs.110).aspx

like image 37
cubitouch Avatar answered Oct 11 '22 14:10

cubitouch