Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Log In Control with Ajax

Log In Control with Ajax

Scheduled Pinned Locked Moved ASP.NET
sysadminsecuritytoolshelp
12 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kushMuchaal
    wrote on last edited by
    #1

    Hi friends! I am very new to Ajax. I want to use ajax in my website for making intrective;During Ajax I faced some problem ;Plz give me right direction. Problem: I have used the Login Control for Authenticatin.My Authentication function is working well; But for authentication full webpage is going to Refresh. I want to authenticate but without the full webpage refresh. Means by using the Ajax authentication should be done without full webpage refresh. Code:

    ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <table bordercolor="#990000">
    <tr>
    <td bgcolor="#990000" colspan="4" style="height: 12px">
    <span style="font-size: 11pt; font-family: Tahoma"><strong> <span style="font-size: 10pt"><span
    style="color: #ffffff">Utility<span> Login</span></span></span></strong></span></td>
    </tr>
    <tr>
    <td style="width: 79px; height: 29px">
    <span style="font-size: 10pt; font-family: Verdana">User ID</span></td>
    <td style="width: 92px; height: 29px">
    <asp:TextBox ID="txtuid" runat="server" Height="15px" Width="100px"></asp:TextBox></td>
    <td colspan="2" style="width: 3px; height: 29px">
    <asp:Label ID="Label3" runat="server" ForeColor="Red" Text="*" Visible="False"></asp:Label></td>
    </tr>
    <tr style="font-size: 10pt; color: #000000; font-family: Verdana">
    <td style="width: 79px">
    <span><span>Password</span></span

    S N 3 Replies Last reply
    0
    • K kushMuchaal

      Hi friends! I am very new to Ajax. I want to use ajax in my website for making intrective;During Ajax I faced some problem ;Plz give me right direction. Problem: I have used the Login Control for Authenticatin.My Authentication function is working well; But for authentication full webpage is going to Refresh. I want to authenticate but without the full webpage refresh. Means by using the Ajax authentication should be done without full webpage refresh. Code:

      ScriptManager ID="ScriptManager1" runat="server">
      </asp:ScriptManager>
      <asp:UpdatePanel ID="UpdatePanel1" runat="server">
      <ContentTemplate>
      <table bordercolor="#990000">
      <tr>
      <td bgcolor="#990000" colspan="4" style="height: 12px">
      <span style="font-size: 11pt; font-family: Tahoma"><strong> <span style="font-size: 10pt"><span
      style="color: #ffffff">Utility<span> Login</span></span></span></strong></span></td>
      </tr>
      <tr>
      <td style="width: 79px; height: 29px">
      <span style="font-size: 10pt; font-family: Verdana">User ID</span></td>
      <td style="width: 92px; height: 29px">
      <asp:TextBox ID="txtuid" runat="server" Height="15px" Width="100px"></asp:TextBox></td>
      <td colspan="2" style="width: 3px; height: 29px">
      <asp:Label ID="Label3" runat="server" ForeColor="Red" Text="*" Visible="False"></asp:Label></td>
      </tr>
      <tr style="font-size: 10pt; color: #000000; font-family: Verdana">
      <td style="width: 79px">
      <span><span>Password</span></span

      S Offline
      S Offline
      saini arun
      wrote on last edited by
      #2

      kushMuchaal wrote:

      I have used the Login Control for Authenticatin

      Where is your login control?

      N 1 Reply Last reply
      0
      • K kushMuchaal

        Hi friends! I am very new to Ajax. I want to use ajax in my website for making intrective;During Ajax I faced some problem ;Plz give me right direction. Problem: I have used the Login Control for Authenticatin.My Authentication function is working well; But for authentication full webpage is going to Refresh. I want to authenticate but without the full webpage refresh. Means by using the Ajax authentication should be done without full webpage refresh. Code:

        ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
        <table bordercolor="#990000">
        <tr>
        <td bgcolor="#990000" colspan="4" style="height: 12px">
        <span style="font-size: 11pt; font-family: Tahoma"><strong> <span style="font-size: 10pt"><span
        style="color: #ffffff">Utility<span> Login</span></span></span></strong></span></td>
        </tr>
        <tr>
        <td style="width: 79px; height: 29px">
        <span style="font-size: 10pt; font-family: Verdana">User ID</span></td>
        <td style="width: 92px; height: 29px">
        <asp:TextBox ID="txtuid" runat="server" Height="15px" Width="100px"></asp:TextBox></td>
        <td colspan="2" style="width: 3px; height: 29px">
        <asp:Label ID="Label3" runat="server" ForeColor="Red" Text="*" Visible="False"></asp:Label></td>
        </tr>
        <tr style="font-size: 10pt; color: #000000; font-family: Verdana">
        <td style="width: 79px">
        <span><span>Password</span></span

        N Offline
        N Offline
        Not Active
        wrote on last edited by
        #3

        So what issues/problems are you having? IMO login should not be done via ajax. The initial page should display only publicly accessible information, after authentication the user should be redirected to secured content.


        I know the language. I've read a book. - _Madmatt

        K 1 Reply Last reply
        0
        • S saini arun

          kushMuchaal wrote:

          I have used the Login Control for Authenticatin

          Where is your login control?

          N Offline
          N Offline
          Not Active
          wrote on last edited by
          #4

          arun$aini wrote:

          Where is your login control?

          Probably all that stuff we call html and server control tags, like textbox and button. :rolleyes:


          I know the language. I've read a book. - _Madmatt

          S 1 Reply Last reply
          0
          • N Not Active

            So what issues/problems are you having? IMO login should not be done via ajax. The initial page should display only publicly accessible information, after authentication the user should be redirected to secured content.


            I know the language. I've read a book. - _Madmatt

            K Offline
            K Offline
            kushMuchaal
            wrote on last edited by
            #5

            Thanks for gving interest in my problem; Language: C# with Asp.net using AJAX After using the update panel including authentication Table(userName,Password)the following error occur; Wats the reason for this Error; Sys.WebForm.PageRequestManagerParserErrorException:THis msg recieved from the server could not be parsed.Common cause for this error are when the response is modified by calls to Response.Write(), response filters,HttpModules.or server trace is Enabled. Details:Erro parsing near' |<html> <Head> '.

            N 1 Reply Last reply
            0
            • K kushMuchaal

              Thanks for gving interest in my problem; Language: C# with Asp.net using AJAX After using the update panel including authentication Table(userName,Password)the following error occur; Wats the reason for this Error; Sys.WebForm.PageRequestManagerParserErrorException:THis msg recieved from the server could not be parsed.Common cause for this error are when the response is modified by calls to Response.Write(), response filters,HttpModules.or server trace is Enabled. Details:Erro parsing near' |<html> <Head> '.

              N Offline
              N Offline
              Not Active
              wrote on last edited by
              #6

              Have you made sure the httpmodules for ajax have been added to the web.config?


              I know the language. I've read a book. - _Madmatt

              K 1 Reply Last reply
              0
              • N Not Active

                arun$aini wrote:

                Where is your login control?

                Probably all that stuff we call html and server control tags, like textbox and button. :rolleyes:


                I know the language. I've read a book. - _Madmatt

                S Offline
                S Offline
                saini arun
                wrote on last edited by
                #7

                I thought he was talking about the asp.net login control. :~

                1 Reply Last reply
                0
                • N Not Active

                  Have you made sure the httpmodules for ajax have been added to the web.config?


                  I know the language. I've read a book. - _Madmatt

                  K Offline
                  K Offline
                  kushMuchaal
                  wrote on last edited by
                  #8

                  Yes Sir I have already Added to the webconfig.

                  N 1 Reply Last reply
                  0
                  • K kushMuchaal

                    Hi friends! I am very new to Ajax. I want to use ajax in my website for making intrective;During Ajax I faced some problem ;Plz give me right direction. Problem: I have used the Login Control for Authenticatin.My Authentication function is working well; But for authentication full webpage is going to Refresh. I want to authenticate but without the full webpage refresh. Means by using the Ajax authentication should be done without full webpage refresh. Code:

                    ScriptManager ID="ScriptManager1" runat="server">
                    </asp:ScriptManager>
                    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                    <table bordercolor="#990000">
                    <tr>
                    <td bgcolor="#990000" colspan="4" style="height: 12px">
                    <span style="font-size: 11pt; font-family: Tahoma"><strong> <span style="font-size: 10pt"><span
                    style="color: #ffffff">Utility<span> Login</span></span></span></strong></span></td>
                    </tr>
                    <tr>
                    <td style="width: 79px; height: 29px">
                    <span style="font-size: 10pt; font-family: Verdana">User ID</span></td>
                    <td style="width: 92px; height: 29px">
                    <asp:TextBox ID="txtuid" runat="server" Height="15px" Width="100px"></asp:TextBox></td>
                    <td colspan="2" style="width: 3px; height: 29px">
                    <asp:Label ID="Label3" runat="server" ForeColor="Red" Text="*" Visible="False"></asp:Label></td>
                    </tr>
                    <tr style="font-size: 10pt; color: #000000; font-family: Verdana">
                    <td style="width: 79px">
                    <span><span>Password</span></span

                    S Offline
                    S Offline
                    saini arun
                    wrote on last edited by
                    #9

                    What code you have written on Button1_Click1 event?

                    K 1 Reply Last reply
                    0
                    • S saini arun

                      What code you have written on Button1_Click1 event?

                      K Offline
                      K Offline
                      kushMuchaal
                      wrote on last edited by
                      #10

                      I have used this code;

                      protected void Button1_Click1(object sender, EventArgs e)
                      {

                          string str = "select \* from userlogin where userid='" + this.txtuid.Text + "' and password='" + this.txtpassword.Text + "'";
                          OracleDataReader dr = dms\_obj.GetDataReader(str);
                          if (dr.Read())
                          {
                      
                              Session\["username"\] = txtuid.Text;
                              string sess = Convert.ToString(Session\["username"\]);
                              Session\["password"\] = txtpassword.Text;
                              string pass = Session\["password"\].ToString();
                      
                              Label1.Visible = true;
                              Label1.Text = "Authentication Success";
                              txtuid.Text = "";
                              txtpassword.Text = "";
                      
                            }
                          else
                          {
                              //Alert("Invalid User name/Password");
                              Label1.Text = "InValid UserName/Password";
                              txtuid.Text = "";
                              txtpassword.Text = "";
                          }
                      }
                      
                      N 1 Reply Last reply
                      0
                      • K kushMuchaal

                        Yes Sir I have already Added to the webconfig.

                        N Offline
                        N Offline
                        Not Active
                        wrote on last edited by
                        #11

                        I'd go with my original response, you are gaining nothing in the login process by trying to use AJAX.


                        I know the language. I've read a book. - _Madmatt

                        1 Reply Last reply
                        0
                        • K kushMuchaal

                          I have used this code;

                          protected void Button1_Click1(object sender, EventArgs e)
                          {

                              string str = "select \* from userlogin where userid='" + this.txtuid.Text + "' and password='" + this.txtpassword.Text + "'";
                              OracleDataReader dr = dms\_obj.GetDataReader(str);
                              if (dr.Read())
                              {
                          
                                  Session\["username"\] = txtuid.Text;
                                  string sess = Convert.ToString(Session\["username"\]);
                                  Session\["password"\] = txtpassword.Text;
                                  string pass = Session\["password"\].ToString();
                          
                                  Label1.Visible = true;
                                  Label1.Text = "Authentication Success";
                                  txtuid.Text = "";
                                  txtpassword.Text = "";
                          
                                }
                              else
                              {
                                  //Alert("Invalid User name/Password");
                                  Label1.Text = "InValid UserName/Password";
                                  txtuid.Text = "";
                                  txtpassword.Text = "";
                              }
                          }
                          
                          N Offline
                          N Offline
                          Not Active
                          wrote on last edited by
                          #12

                          string str = "select * from userlogin where userid='" + this.txtuid.Text + "' and password='" + this.txtpassword.Text + "'";

                          Unvalidated user input placed directly into inline SQL? :omg: What's the point of having a login? Have you ever heard of SQL Injection attacks?

                          Session["password"] = txtpassword.Text;

                          NEVER, EVER store a password in memory!!

                          Session["username"] = txtuid.Text;
                          string sess = Convert.ToString(Session["username"]);
                          Session["password"] = txtpassword.Text;
                          string pass = Session["password"].ToString();

                          This is useless code. Put the text to Session variable then the Session variable to a local variable. :wtf: You don't even use the local variables.


                          I know the language. I've read a book. - _Madmatt

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups