Re: Message not displayed

From: Colin Basterfield (colinbasterfield_at_hotmail.com)
Date: 03/06/04


Date: Sun, 7 Mar 2004 12:55:34 +1300

Yes of course:

private void btnLogin_Click(object sender, System.EventArgs e)
{
bool pwdVerified = false;
try
{
pwdVerified = VerifyPassword(txtUserName.Text, txtPassword.Text);
}
catch (Exception ex)
{
lblMessage.Text = ex.Message;
return;
}
if (pwdVerified == true)
{
lblMessage.Text = "";
// Creates an authentication ticket and attaches it to the cookie's collection of the outgoing
// response. It does not perform a redirect.
FormsAuthentication.SetAuthCookie(txtUserName.Text, true);

// Set the UserID in the session variable

Session["UserID"] = txtUserName.Text;

// Move to the Selection screen

Response.Redirect("Selection.aspx");

}

else

{

lblMessage.Text = "Invalid username or password";

}

}

Nothing much to it than that really.

Any ideas?
Colin B
"Sharon" <talsharon@hotmail.com> wrote in message news:e2RgtY3AEHA.1964@TK2MSFTNGP11.phx.gbl...
> Can we see the code?
>
> "Colin Basterfield" <colinbasterfield@hotmail.com> wrote in message
> news:OT%23uztyAEHA.1076@TK2MSFTNGP12.phx.gbl...
> > Hi,
> >
> > I have a Login screen which has a Label on it, and if the login is
> > successful it clears the message and moves to the main screen, but if the
> > login fails due to a bad password or username the text property of the
> label
> > is assigned "bad Username or Password", however although stepping thro the
> > code it does hit that line it doesn't display the message.
> >
> > Prolly something silly but I don't what it is yet so...
> >
> > TIA
> > Colin B
> >
> >
>
>



Relevant Pages

  • Re: Message not displayed
    ... lblMessage.Text = "Invalid username or password"; ... >> I have a Login screen which has a Label on it, ... >> Colin B ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Message not displayed
    ... > I have a Login screen which has a Label on it, ... > successful it clears the message and moves to the main screen, ... > Colin B ...
    (microsoft.public.dotnet.framework.aspnet)
  • Forms Authentication with Active Directory, login control crashes
    ... using the login control that came with V.S. 2005. ... catch the exception so that I can display a friendly and helpful message to ... username, String password) +221 ... System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) ...
    (microsoft.public.dotnet.security)
  • Re: The IListSource does not contain any data sources.
    ... You said that things break after you try to login, ... The IListSource does not contain any data sources. ... Exception Details: System.Web.HttpException: The IListSource does ... be identified using the exception stack trace below. ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: Single Sign-On User Credentials Question
    ... This seems to indicate that it can't find the login URL for my application. ... I created a single signon web part starting from the same code sample you ... The sample uses "SampleApp" in the call to GetCredentials, ... I get the same error message when an unhandled exception occurrs. ...
    (microsoft.public.sharepoint.portalserver)