Trying to login on the basis of emald and password stored on my database, But I am getting exceptions. Why?

//This code is of login button
protected void Button1_Click1(object sender, EventArgs e)
        SqlDataReader dr;
        SqlConnection conn = new SqlConnection(GetConnectionString());
        string sql = "SELECT PASSWORD FROM ACCOUNT WHERE EMAILID='"
                    +TextBox1.Text+"'";
        try
        conn.Open();
        SqlCommand cmd = new SqlCommand(sql, conn);
        dr = cmd.ExecuteReader();
            if (dr[0].ToString() == TextBox2.Text)
                Response.Redirect("http://www.microsoft.com");
            else
                Label1.Text = "Wrong Details!";
        catch
            Label1.Text = "Error!";
        //finally
        //    conn.Close();
//Please Help me! Thanks.
KGProgrammer

     SqlConnection conn = new SqlConnection(GetConnectionString());
        string sql = "SELECT PASSWORD FROM ACCOUNT WHERE EMAILID='"
                    +TextBox1.Text+"'";
Hello,
Based on your code, you may have a SQL injection vulnerability. You can try to use parameterized query that assign user input to a parameter instead of embedding user input in the query statement.For example:
Using(SqlCommand cmd = new SqlCommand("SELECT * FROM ACCOUNT WHERE emailid = @id AND password = @pw",conn))
cmd.Parameters.AddWithValue("@id",TextBox1.Text);
cmd.Parameters.AddWithValue("@pw",TextBox2.Text);
SqlDataReader dr = cmd.ExecuteReader();
If(dr.HasRows)
Response.Redirect("http://www.microsoft.com");
else
Label1.Text = "Wrong Details!";
The following thread is about a similar requirement, please refer to:
http://stackoverflow.com/questions/16618212/c-sharp-database-log-in-form
Regards,
Fanny Liu
Fanny Liu
TechNet Community Support

Similar Messages

  • I recently updated my primary email address associated with my Apple ID account. When I go to App store on my iPad it still tries to login to the App store using the old email address I had associated with the account, and naturally my password doesn

    I recently updated my primary email address associated with my Apple ID account.
    Now when I go to App store on my iPad it still tries to login to the App store using the old email address I had associated with the account, and naturally my password doesn't work. I can't figure out how to tell my iPad to login using the updated email address.
    So in effect I'm locked out of the app store and I currently have 26 updates waiting.
    I've tried disconnecting and reconnecting my IPad to iCloud with no luck.. However I cloud happens to show the correct/updated email address.
    Does anyone know how to resolve this?
    Thanks

    Did you change the email for the Apple ID or did you create a new Apple ID? A new Apple ID cannot be used with content that was bought using a different Apple ID.
    Changing the email address you use for your Apple ID -
    http://support.apple.com/kb/HT5621

  • Error when trying to login in the WebConsole

    Hello,
    I'm trying to login in the WebConsole when the following error appears:
    Internal Server Error 500!
    java.lang.NoClassDefFoundError: com/sap/ip/me/webconsole/proxy/authority/Me_Jsp_Smomo_Check_Authority_Input
         at com.sap.ip.me.webconsole.RemoteCall.checkPermission          (pc 9)
         at com.sap.ip.me.webconsole.Authentication.verifyPermission     (pc 10)
         at com.sap.ip.me.webconsole.ControllerServlet.execute           (pc 155)
         at com.sap.ip.me.webconsole.ControllerServlet.doGet             (pc 106)
         at com.sap.ip.me.webconsole.ControllerServlet.doPost            (pc 3)
         at javax.servlet.http.HttpServlet.service(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) (HttpServlet.java:760) (pc 139)
         at javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest,javax.servlet.ServletResponse) (HttpServlet.java:853) (pc 30)
         at com.inqmy.services.servlets_jsp.server.RunServlet.runSerlvet (RunServlet.java:149) (pc 808)
         at com.inqmy.services.servlets_jsp.server.ServletsAndJspImpl.startServlet (ServletsAndJspImpl.java:832) (pc 103)
         at com.inqmy.services.httpserver.server.RequestAnalizer.checkFilename (RequestAnalizer.java:666) (pc 1433)
         at com.inqmy.services.httpserver.server.RequestAnalizer.handle (RequestAnalizer.java:313) (pc 776)
         at com.inqmy.services.httpserver.server.Response.handle (Response.java:173) (pc 37)
         at com.inqmy.services.httpserver.server.HttpServerFrame.request (HttpServerFrame.java:1288) (pc 1443)
         at com.inqmy.core.service.context.container.session.ApplicationSessionMessageListener.process (ApplicationSessionMessageListener.java:36) (pc 30)
         at com.inqmy.core.cluster.impl5.ParserRunner.run (ParserRunner.java:55) (pc 43)
         at com.inqmy.core.thread.impl0.ActionObject.run (ActionObject.java:46) (pc 17)
         at java.security.AccessController.doPrivileged(java.security.PrivilegedAction,java.security.AccessControlContext) (AccessController.java)
         at com.inqmy.core.thread.impl0.SingleThread.run (SingleThread.java:148) (pc 429)
    The user used to login has associated the roles SAP_ALL and  SAP_NEW as well as the Authorization Objects s_me_sync, s_rfc and s_tcode.
    Maybe is this due to the level of patches of the SAP J2EE Engine? If not, somebody knows what can be the cause of that error?
    Bests regards,
    Mireia

    Hello Mireira,
    I am assuming that you are using ME 2.1 SP03.
    please make sure that the webConsole deployment was successfull. The deployment manager almost always report a success but to be sure have a look at the deployment log located under j2ee\deploy\<Project folder>\
    If everything is right there please make sure that you have used the right versions of the webConsole libs (i.E. SAPmdi.jar, aii_proxy.jar, ...) You find these versions attached to SAP note 726188.
    Please check these possible issues.
    Regards, Tim

  • What does "unknown error has occurred mean when trying to login to the app store

    what does "unknown error has occurred" mean when trying to login to the app store

    Welcome to the Apple forums.
    Good idea to fill out your profile so people can see what machine you are writing about.    
    Also a good idea to do a little research through the 'More like this' panel to the right of your initial post.    Each of the threads also contains more leads so it is amazing how much you can learn from them.
    Good hunting.

  • I have tried to login on the BB Lounge and no go

    Does anyone have a email or site that I can contact the BB Lounge. I have tried and tried to login to the BB Lounge with no success. I have gotten the password from them but it does not work.
    Please help if possible.
    David 

    I too registered for that site but whenever I tried to login it says email address in not yet registered!!!!
    I tried to register myself again but registration page becomes empty again even after fulfilling all the requirements.
    Moreover, many country names are missing where BlackBerry  service is up and running.
    RIM associates should come up with an answer to that. 
    tanzim                                                                                  
    If your query is resolved then please click on “Accept as Solution”
    Click on the LIKE on the bottom right if the post deserves credit

  • I have a iphone 5 and I can login with my apple id to purchase music. However, when I try to login into icloud using the very same username and password that I use in the apple store it does not work to enter icloud, so what what gives???

    I have a iphone 5 and I can login with my apple id to purchase music. However, when I try to login into icloud using the very same username and password that I use in the apple store it does not work to enter icloud, so what what gives???

    I could do that, however when I select the icloud button (or whatever the heck it is) I am asked to enter the apple id and password. So if you are suppose to create another one for icloud you'd think it would give you the option at this point which would be logical.

  • I currently have iPhoto 8.1.2 on my macbook pro and am trying to update to the latest version.  I have had to work backward, but I can only get back to 9.1, which will not install because it says I need at least 9.0 to install it. Is 9.0 available?

    I currently have iPhoto 8.1.2 on my macbook pro and am trying to update to the latest version.  I have had to work backward, but I can only get back to 9.1, which will not install because it says I need at least 9.0 to install it. Is 9.0 available?  Will I need to go back even further?  Thanks

    Upgrading from iPhoto 8 to iPhoto 9 requires a purchase. There are two ways to get to iPhoto 9: 
    1 - purchase a copy of the iLife 11 disk from a 3rd party retailer like Amazon.com or eBay.com.
    2 - if your MBP meets the requirements upgrade you system for free to Mavericks.  Then you can purchase the latest iPhoto version, 9.5.1, from the App Store.
    OT

  • Am trying to update iPod that has iOS 2.2.1 to iOS 4.2 but I am getting the following error message, the iPod could not be restored. An unknown error occured (-1).

    Hi , I am trying to update iPod that has iOS 2.2.1 to iOS 4.2 but I am getting the following error message, "the iPod could not be restored. An unknown error occured (-1)." I would appreciate if anyone could let me know what the problem is and if it is possible how to fix it? Thanks

    Error -1
    Attempt to restore your iOS device two more times. If the issue is still unresolved, the device may need service.
    The "device may need service" means a hardware problem. In that case make an appointment at the Genius Bar of an Apple store.
    Apple Retail Store - Genius Bar

  • I am trying to export the combained PDF based on BOOK opetion using below scripts. but i am getting following error message "Invalid value for parameter 'to' of method 'exportFile'. Expected File, but received 1952403524". anyone knows, please suggest me

    Dear ALL,
    i am trying to export the combained PDF based on BOOK opetion using below scripts. but i am getting following error message "Invalid value for parameter 'to' of method 'exportFile'. Expected File, but received 1952403524". anyone knows, please suggest me solutions.
    var myBookFileName ,myBookFileName_temp;
                    if ( myFolder != null )
                            var myFiles = [];
                            var myAllFilesList = myFolder.getFiles("*.indd");    
                            for (var f = 0; f < myAllFilesList.length; f++)
                                        var myFile = myAllFilesList[f]; 
                                        myFiles.push(myFile);
                            if ( myFiles.length > 0 )
                                        myBookFileName = myFolder + "/"+ myFolder.name + ".indb";
                                        myBookFileName_temp=myFolder.name ;
                                        myBookFile = new File( myBookFileName );
                                        myBook = app.books.add( myBookFile );  
                                       myBook.automaticPagination = false;
                                        for ( i=0; i < myFiles.length; i++ )
                                                   myBook.bookContents.add( myFiles[i] );             
                                        var pdfFile =File(File(myFolder).fsName + "\\"+myBookFileName_temp+"_WEB.pdf");
                                        var bookComps = myBook.bookContents;
                                        if (bookComps.length === 1)
                                                       bookComps = [bookComps];
                                         var myPDFExportPreset = app.pdfExportPresets.item("AER6");
                                        app.activeBook.exportFile(ExportFormat.PDF_TYPE,File("D:\\AER\\WEBPDF.pdf"),false,myPDFEx portPreset,bookComps);
                                      //myBook.exportFile (ExportFormat.pdfType, pdfFile, false);
                                      //myBook.exportFile(pdfFile, false, pdfPref, bookComps);
                                        myBook.close(SaveOptions.yes);      

    Change the below line:
    app.activeBook.exportFile(ExportFormat.PDF_TYPE,File("D:\\AER\\WEBPDF.pdf"),false,myPDFExp ortPreset,bookComps);
    to
    app.activeBook.exportFile(ExportFormat.PDF_TYPE,File("D:\\AER\\WEBPDF.pdf"),false,myPDFExp ortPreset);
    Vandy

  • I have iphone 4s with iO6. My problem is I can no longer update my apps since "cannot connect to itunes" always shows on my screen when i try to. Tried fixing by changing the dates, turning off location as suggested in some forums but both didn't work!

    I have iphone 4s with iO6. My problem is I can no longer update my apps since "cannot connect to itunes store" always shows on my screen when i try to. Tried fixing by changing the dates, turning off location as suggested in some forums but both didn't work!  Please help!! Thanks.

    You can not merge accounts.
    Apps are tied to the Apple ID used to download them, you can not transfer them.

  • I tried to share a photo using e-mail and when I set up my gmail account I typed in the wrong user name and password.  Now i can't share photos using e-mail.

    I tried to share a photo using e-mail and when i set up my gmail account I typed in the wrong user name and password.
    Now I can't send a photo because i get an error message saying the user name and password do not match.
    How do i save a new gmail user name and password??

    iPhoto Menu ->
    Preferences ->
    Accounts ->
    Delete and recreate your email settings.
    Alternatively, use Apple's Mail for the job. It has Templates too - and more of them.

  • I am trying to transfer my contacts to my iphone from a Casio G'zOne phone but I keep getting Connection Unsuccessful. How do I transfer the contacts?

    I am new to Apple products and I am trying to transfer my contacts to my iphone from a Casio G'zOne phone but I keep getting Connection Unsuccessful. How do I transfer the contacts?

    How are you trying to transfer them? Via Bluetooth? If so, that will not work.
    You need to get the contacts from the Casio phone into a supported contact manager on your computer (Address Book/Contacts on a Mac or Outlook on a PC) then sync them to the iPhone via iTunes or iCloud.

  • I'm trying to update to the new OS X, and its saying I don't have enough space on my start up disc. What do I need to do?

    I'm trying to update to the new OS X, and its saying I don't have enough space on my start up disc. What do I need to do?

    offload large files , vids pics, music to an external HD.

  • Hi,  Trying to log in with my user id and password at iocbc but was not able to access. Problem message shown : Applet not initialised or may not be supported. Please refresh the page or check the browser setting  Anyone can advise? or i need to download?

    Hi,
    i have the same problem?
    Trying to log in with my user id and password at iocbc but was not able to access.
    Problem message shown : Applet not initialised or may not be supported. Please refresh the page or check the browser setting
    Anyone can advise?

    You need to install Java for your Mac OS version, and/or make sure it's enabled in the Java Preferences application and your browser's preferences.

  • I have been trying for three days to try and get this working , and tried a few of the forum suggestions already and this is just to try them ... so glad i haven't pais anything yet . i get the signed out loop no matter what i try

    i have been trying for three days to try and get this working , and tried a few of the forum suggestions already and this is just to try them ... so glad i haven't pais anything yet . i get the signed out loop no matter what i try

    What have you been trying for three days to try and get this working???
    Supply pertinent information for quicker answers
    The more information you supply about your situation, the better equipped other community members will be to answer. Consider including the following in your question:
    Adobe product and version number
    Operating system and version number
    The full text of any error message(s)
    What you were doing when the problem occurred
    Screenshots of the problem
    Computer hardware, such as CPU; GPU; amount of RAM; etc.

Maybe you are looking for

  • What is better choice than Time Machine

    I have a Seagaye GoFlex for Mac ( 2TB) external HD. I have fought with this drive and Time machine for over a year. I have partitioned the drive (2) to use for other purposes. 500 GB is for backup. Often it won't Backup. Sometimes it indicates it's r

  • Payment due date for Asset capital lease

    Hi Gurus We are using capital lease in our client and opening vendor postings are created when we click on opening posting leasing tab of asset master. The issue is with the payment due dates. If my lease duration is 60 months than I get 60 open item

  • Descrepency in BOM Report

    Dear All Please clarify the following discrepancy I found in BOM report in one of my Customer database:   Schenario - 1       Parent Item A  --  Qty 1 kg             Child Item B  --  Qty 1.2 kg        Parent Item B  --  Qty 1 kg               Child

  • Disable Delete function on Menu in Tcode IW32

    Dear all, I want to disable Delete function on Menu in Tcode IW32 when the status Maintenance Order is LOCK, please help me!!! 1. The status of a Maintenance Order is LOCK 2. Disable Delete function

  • Problem migrating sales orders

    Hi all, I have a problem with the migration of sales orders from one SAP system to other. Scenario: A SAP system with sales orders and with its own condition types (prices and discounts). The data of sales orders pending for billing have been extract