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?
The following code example uses a Login control to provide a UI for logging in to a Web site.
<%@ Page Language="C#" %><%@ Import Namespace="System.ComponentModel" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">www.w3.org/.../xhtml1-transitional.dtd">
<script runat="server">bool IsValidEmail(string strIn){ // Return true if strIn is in valid email format. return Regex.IsMatch(strIn, @"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$"); }
void OnLoggingIn(object sender, System.Web.UI.WebControls.LoginCancelEventArgs e){ if (!IsValidEmail(Login1.UserName)) { Login1.InstructionText = "Enter a valid email address."; Login1.InstructionTextStyle.ForeColor = System.Drawing.Color.RosyBrown; e.Cancel = true; } else { Login1.InstructionText = String.Empty; }}
void OnLoginError(object sender, EventArgs e){ Login1.HelpPageText = "Help with logging in..."; Login1.PasswordRecoveryText = "Forgot your password?";}</script>
<html xmlns="">http://www.w3.org/1999/xhtml" > <head runat="server"> <title>ASP.NET Example</title></head><body> <form id="form1" runat="server"> <asp:Login id="Login1" runat="server" BorderStyle="Solid" BackColor="#F7F7DE" BorderWidth="1px" BorderColor="#CCCC99" Font-Size="10pt" Font-Names="Verdana" CreateUserText="Create a new user..." CreateUserUrl="newUser.aspx" HelpPageUrl="help.aspx" PasswordRecoveryUrl="getPass.aspx" UserNameLabelText="Email address:" OnLoggingIn="OnLoggingIn" OnLoginError="OnLoginError" > <TitleTextStyle Font-Bold="True" ForeColor="#FFFFFF" BackColor="#6B696B"> </TitleTextStyle> </asp:Login>
</form> </body></html>
UNO Online returns with a slew of new features, including video chat support and a brand-new theme system that adds even more fun!
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); }
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 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'"); } ...}