none
C# stored procedure call works with output parameters in Internet Explorer, but not in Chrome RRS feed

  • Question

  • The same C# code exectues for both, but when I execute the following in Chrome, the output parameters do not get filled.

    using (SqlConnection conn = new SqlConnection(connectionString))
            using (SqlCommand cmd = new SqlCommand("exp_CustomerLogin", conn))
             {
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@EmailInput", txtEmail.Text);
                cmd.Parameters.AddWithValue("@PasswordInput", txtPassword.Text);
                cmd.Parameters.Add("@PasswordSaltOut", SqlDbType.NVarChar, 50).Direction = ParameterDirection.Output;
                cmd.Parameters.Add("@PasswordOut", SqlDbType.VarBinary,150).Direction = ParameterDirection.Output;
                cmd.Parameters.Add("@InsertedSequenceID", SqlDbType.BigInt).Direction = ParameterDirection.Output;
      try
                {
                    conn.Open();
                    if (conn.State == ConnectionState.Open)
                    { 
                        rowsaffected = cmd.ExecuteNonQuery(); 
                    }
                    
                    //The following statment returns NULL in Chrome, and the salt in IE
                    SaltAsString = (string)cmd.Parameters["@PasswordSaltOut"].Value;
    }



    Steven DeSalvo

    Saturday, April 22, 2017 3:18 PM

Answers

  • The email input string was being truncated and the entire string was not being sent to the stored procedure.  Fixing this truncation solved the problem.

    Steven DeSalvo

    • Marked as answer by StevenDE2012 Wednesday, April 26, 2017 4:42 AM
    Wednesday, April 26, 2017 4:42 AM

All replies

  • Have you checked if input values — E-mail and password — are correctly received? You can also write some known strings instead of text boxes in order to check that the procedure works regardless of browser.

    Saturday, April 22, 2017 5:26 PM
  • Thanks for your reply Viorel

    I tried adding the text to string variables and then passing that to the stored procedure, but again, this works in Internet Explorer and not in Chrome.  I am using the localhost within Visual Studio to run this, but surely it doesn't care which browser is submitting the request, does it?  

    I thought asp.net was browser agnostic and would just render back the appropriate html to diplay back to whatever browser requested information.

    Still trying to get this to work, but may just have to settle for this in IE for now. 


    Steven DeSalvo

    Monday, April 24, 2017 4:09 AM
  • I also tried publishing the entire project to IIS and once again, the stored procedure works in IE but not in Chrome. 


    Steven DeSalvo

    Wednesday, April 26, 2017 2:08 AM
  • The email input string was being truncated and the entire string was not being sent to the stored procedure.  Fixing this truncation solved the problem.

    Steven DeSalvo

    • Marked as answer by StevenDE2012 Wednesday, April 26, 2017 4:42 AM
    Wednesday, April 26, 2017 4:42 AM