c# - ACS signout redirect not working -
working on acs sso, , signout process works fine. problem users remain on same page calls logout action, no matter have set redirect to
public actionresult logout() { //load identity configuration federationconfiguration config = federatedauthentication.federationconfiguration; //get wtrealm wsfederationconfiguration section string wtrealm = config.wsfederationconfiguration.realm; string wreply = wtrealm; //read acs ws-federation endpoint web.config string wsfederationendpoint = configurationmanager.appsettings["ida:issuer"]; signoutrequestmessage signoutrequestmessage = new signoutrequestmessage(new uri(wsfederationendpoint)); signoutrequestmessage.parameters.add("wreply", wreply); signoutrequestmessage.parameters.add("wtrealm", wtrealm); string signouturl = signoutrequestmessage.writequerystring(); federatedauthentication.wsfederationauthenticationmodule.signout(); return this.redirect(signouturl); }
to execute action, page has click handler
$('#logout').click(function () { $.post('@url.action("logout", "home", new { area = "" })'); });
a click correctly handled, logout action called , executed, site remains on calling page. network log shows call logout, no evidence redirect being attempted. in effort debug, have commented out redirect signouturl , tried redirecttoaction, redirecttoroute, , javascript call set window.location, none of seem fare better @ transferring user different page. missing?
what ended doing moving logout logic model class
public class logouthandler { public string signout() { // load identity configuration federationconfiguration config = federatedauthentication.federationconfiguration; // wtrealm wsfederationconfiguation section string wtrealm = config.wsfederationconfiguration.realm; string wreply; wreply = wtrealm; // read acs ws-federation endpoint web.config string wsfederationendpoint = configurationmanager.appsettings["ida:issuer"]; signoutrequestmessage signoutrequestmessage = new signoutrequestmessage(new uri(wsfederationendpoint)); signoutrequestmessage.parameters.add("wreply", wreply); signoutrequestmessage.parameters.add("wtrealm", wtrealm); federatedauthentication.sessionauthenticationmodule.signout(); return signoutrequestmessage.writequerystring(); } }
and having logout action call class return url, , redirect it. worked then, though don't know if there take account mobile
public actionresult logout() { string signouturl = new logouthandler().signout(); return redirect(signouturl); }
Comments
Post a Comment