Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Close Client's Browser

Status
Not open for further replies.

peace2007

Programmer
Aug 16, 2007
8
IR
Hi,

I'm developing a web chat application and need to close one of user's browser or disable a few controls from server side.

the exact thing I need to do is let one user make another user log out of chat room so I try to redirect it to another page and perform the logout action in it:

Response.Redirect("Server.aspx?action=Logout&u=" + userId);

I use the same code on button click events and it works fine. but when I call the related function through javascript code it doesn't go to the Server.aspx!!

[Ajax.AjaxMethod(HttpSessionStateRequirement.ReadWrite)]
public void ExitBrowser(string userId)
{
Response.Redirect("Server.aspx?action=Logout&u=" + userId);
}

Any idea is appreciated!
 
this may work
Code:
[Ajax.AjaxMethod(HttpSessionStateRequirement.ReadWrite)]
public void ExitBrowser(string userId)
{
   Response.Redirect("Server.aspx?action=Logout&u=" + userId, true);       
}
true will end the current reqest and begin another.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Thanks for the information!
However, I tried that but didn't help :(
 
I resolved it through this javascript function:
function ExitBrowser(userid)
{
rnd++;

//userid = location.search.substring( 1, location.search.length );
url = 'Server.aspx?action=Logout&u=' + userid + rnd;

req = getAjax();

req.onreadystatechange = function(){

if( req.readyState == 4 && req.status == 200 ) {
updateAll();
}

}
req.open( 'GET', url, true );
req.send( null );
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top