Click here to Skip to main content
15,886,799 members
Home / Discussions / C#
   

C#

 
GeneralIcons included in EXE Pin
Guinness4Strength23-Mar-04 3:35
Guinness4Strength23-Mar-04 3:35 
GeneralRe: Icons included in EXE Pin
Heath Stewart23-Mar-04 3:45
protectorHeath Stewart23-Mar-04 3:45 
GeneralRe: Icons included in EXE Pin
Guinness4Strength23-Mar-04 4:02
Guinness4Strength23-Mar-04 4:02 
GeneralWeb Service Remote Installation Pin
Braulio Dez23-Mar-04 2:16
Braulio Dez23-Mar-04 2:16 
GeneralRe: Web Service Remote Installation Pin
Mazdak23-Mar-04 2:33
Mazdak23-Mar-04 2:33 
GeneralRe: Web Service Remote Installation Pin
Braulio Dez23-Mar-04 2:40
Braulio Dez23-Mar-04 2:40 
GeneralRe: Web Service Remote Installation Pin
Heath Stewart23-Mar-04 3:25
protectorHeath Stewart23-Mar-04 3:25 
GeneralSimple Authentication Pin
mil_an23-Mar-04 1:53
mil_an23-Mar-04 1:53 
Hi, I am trying to create a very simple authentication form, and am receiving an error. Please help!!
This is the code i have used:

public class login : System.Web.UI.Page <br />
   { <br />
      protected System.Web.UI.WebControls.TextBox txtUsername; <br />
      protected System.Web.UI.WebControls.TextBox txtPassword; <br />
      protected System.Web.UI.WebControls.Label lblCorrectLogin; <br />
      protected System.Web.UI.WebControls.LinkButton LinkButton1; <br />
      protected System.Web.UI.WebControls.Panel pnlLogIn; <br />
      protected System.Web.UI.WebControls.Label lblIsAuthenticated; <br />
<br />
    <br />
      private void Page_Load(object sender, System.EventArgs e) <br />
      { <br />
         if (! Page.IsPostBack) <br />
         { <br />
            if (Session["isAuthenticated"] == null) <br />
            { <br />
               this.lblIsAuthenticated.Text = "null"; <br />
            } <br />
            else <br />
            { <br />
               this.lblIsAuthenticated.Text = Session["isAuthenticated"].ToString(); <br />
            }       <br />
         } <br />
      } <br />
<br />
<br />
private void LinkButton1_Click(object sender, System.EventArgs e) <br />
      { <br />
         // Basic User Authentication, might want to replace with your own!!! <br />
         if (this.txtUsername.Text == "admin" && this.txtPassword.Text == "password") <br />
         { <br />
            // Set the Authentication Session Value <br />
            Session["isAuthenticated"] = true; <br />
<br />
            // Redirect to the Home Page <br />
            Response.Redirect ("hello.aspx"); <br />
         } <br />
         else <br />
         { <br />
            // Show error message informing of unmatching UserName and Password pair <br />
            this.lblCorrectLogin.Text = "Authentification Error!"; <br />
         } <br />
      } 

_______________________
I receive this error:

Line 31:             if (Session["isAuthenticated"] == null) <br />
Line 32:             { <br />
Line 33:                this.lblIsAuthenticated.Text = "null"; <br />
Line 34:             } <br />
Line 35:             else<br />
<br />
Source File: c:\inetpub\wwwroot\authentication\members.aspx.cs  Line: 33 

_______________________

Thanks for your help!!
GeneralRe: Simple Authentication Pin
Mazdak23-Mar-04 2:03
Mazdak23-Mar-04 2:03 
GeneralRe: Simple Authentication Pin
Dave Kreskowiak23-Mar-04 2:04
mveDave Kreskowiak23-Mar-04 2:04 
GeneralRe: Simple Authentication Pin
mil_an23-Mar-04 2:05
mil_an23-Mar-04 2:05 
GeneralRe: Simple Authentication Pin
Mazdak23-Mar-04 2:28
Mazdak23-Mar-04 2:28 
GeneralRe: Simple Authentication Pin
mil_an23-Mar-04 3:08
mil_an23-Mar-04 3:08 
GeneralRe: Simple Authentication Pin
Mazdak23-Mar-04 3:14
Mazdak23-Mar-04 3:14 
GeneralRe: Simple Authentication Pin
Heath Stewart23-Mar-04 3:27
protectorHeath Stewart23-Mar-04 3:27 
GeneralRe: Simple Authentication Pin
Mazdak23-Mar-04 3:34
Mazdak23-Mar-04 3:34 
GeneralRe: Simple Authentication Pin
Dave Kreskowiak23-Mar-04 2:31
mveDave Kreskowiak23-Mar-04 2:31 
GeneralRe: Simple Authentication Pin
Mazdak23-Mar-04 2:36
Mazdak23-Mar-04 2:36 
GeneralRe: Simple Authentication Pin
Dave Kreskowiak23-Mar-04 3:56
mveDave Kreskowiak23-Mar-04 3:56 
GeneralRe: Simple Authentication Pin
Heath Stewart23-Mar-04 3:39
protectorHeath Stewart23-Mar-04 3:39 
GeneralMultiple combos on one DataAdapter Pin
Pete Burgess23-Mar-04 0:53
Pete Burgess23-Mar-04 0:53 
GeneralRe: Multiple combos on one DataAdapter Pin
Heath Stewart23-Mar-04 3:50
protectorHeath Stewart23-Mar-04 3:50 
GeneralRe: Multiple combos on one DataAdapter Pin
Pete Burgess25-Mar-04 9:54
Pete Burgess25-Mar-04 9:54 
GeneralRe: Multiple combos on one DataAdapter Pin
Heath Stewart25-Mar-04 9:55
protectorHeath Stewart25-Mar-04 9:55 
GeneralUser who started the app Pin
nilhz23-Mar-04 0:36
nilhz23-Mar-04 0:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.