I'm using the Microsoft Login component on my login page. After a user is logged in it will not redirect to another page defined in the DestinationPageUrl or using a Server.Redirect in the Loggedin event.
It just sits there...
If I turn off the Warp Panel it works fine.
Any suggestions?
Hi Bob,
Unfortunately the WARP, within its private async postback, does not support server redirect action. To redirect, that action should be moved from a child control (like internal action of "Login") into explicit "redirect" action of WARP. To redirect, you may use window.location or similar. Below is example:
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e){ ... // condition when logic is successful if(e.Authenticated) { // supress default redirect action of login e.Authenticated = false; // supress dummy error message this.Login1.FailureText = ""; // explicitly redirect to desired page (value for DestinationPageUrl) Infragistics.WebUI.Shared.CallBackManager.AddScriptBlock(this, this.WebAsyncRefreshPanel1, "window.location='./Destination.aspx'"); } ...}
HI Victor
I have something similar, but not at the moment of login. My client has been using the application for more than one year and everything works fine, but I did not notice before that when they leave the application in the browser for more than 20 minutes, then the .net session expires. After they come back and execute a postback with warp nothing happen and the waiting cursor there appear and then stop. Users were always thinking that they have to close the browser and open the application again and login it.
So in a normal scenario, the page should redirect automatically to the login page (That happens without the warp really nicely), but with the warp I cannot do it. How the warp can detect that the session has expired and if so how can I send the control to the .net framework authentication?Thanks VictorJorge from Applied Network Solutions
Hi Jorge,
The WARP is not able to check state of server or perform any other similar action.
What you can do, is to write client script (like full postback with redirect on server) which will be executed if user never clicked "action" button located in WARP (login or similar). Below is example:
aspx:
<script type="text/javascript">function endMySession(){ var submitButton = document.getElementById('FullPostBack'); if(submitButton && !window.cancelMyPostBack) submitButton.click();}</script><igmisc:WebAsyncRefreshPanel ID="WebAsyncRefreshPanel1" runat="server" style="border:1px solid red"> <asp:Button ID="StartSession" runat="server" Text="StartSession" onclick="StartSession_Click" /> <asp:Button ID="UserAction" runat="server" Text="UserAction" onclick="UserAction_Click" /></igmisc:WebAsyncRefreshPanel><asp:Button ID="FullPostBack" runat="server" Text="FullPostBack" onclick="FullPostBack_Click" />
cs:
protected void StartSession_Click(object sender, EventArgs e) { string js = "window['cancelMyPostBack']=false; try{window.setTimeout('endMySession()',600000);}catch(e){}"; Infragistics.WebUI.Shared.CallBackManager.AddScriptBlock(this, this.WebAsyncRefreshPanel1, js);// or the same with literalcontrol:// string js = "<script type='text/javascript'>window['cancelMyPostBack']=false; try{window.setTimeout('endMySession()',600000);}catch(e){}</script>";// LiteralControl lc = new LiteralControl(js);// this.WebAsyncRefreshPanel1.Controls.Add(lc); } protected void UserAction_Click(object sender, EventArgs e) { string js = "window['cancelMyPostBack']=true;"; Infragistics.WebUI.Shared.CallBackManager.AddScriptBlock(this, this.WebAsyncRefreshPanel1, js);// or the same with literalcontrol:// string js = "<script type='text/javascript'>window['cancelMyPostBack']=true;</script>";// LiteralControl lc = new LiteralControl(js);// this.WebAsyncRefreshPanel1.Controls.Add(lc); } protected void FullPostBack_Click(object sender, EventArgs e) { string js = "<script type='text/javascript'>window.location='myRedirectPage.aspx'</script>"; LiteralControl lc = new LiteralControl(js); this.WebAsyncRefreshPanel1.Controls.Add(lc); }