Я пытаюсь перенаправить файл login.htm на index.htm. но после выполнения Response.Redirect
он возвращает ошибку сертификации ошибки. и если я нажму, что это сообщение.
System.InvalidOperationException: Parameter: users not found.
場所 System.Web.Services.Protocols.ValueCollectionParameterReader.Read(NameValueCollection collection)
場所 System.Web.Services.Protocols.UrlParameterReader.Read(HttpRequest request)
場所 System.Web.Services.Protocols.HttpServerProtocol.ReadParameters()
場所 System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()
Это мой код аутентификации.
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public void LogMeIn(string users, string pass) {
try
{
// string stmt = "SELECT COUNT(*) FROM tbllogin WHERE userName = '" + users + "' AND passWord ='" + pass + "'";
string stmt = "SELECT COUNT(*) FROM tbllogin WHERE userName = @user AND passWord = @pass";
int count = 0;
using (MySqlConnection thisConnection = new MySqlConnection(connectionString()))
{
using (MySqlCommand cmdCount = new MySqlCommand(stmt, thisConnection))
{
cmdCount.Parameters.AddWithValue("@user", users);
cmdCount.Parameters.AddWithValue("@pass", pass);
thisConnection.Open();
count = Convert.ToInt32(cmdCount.ExecuteScalar());
if (count > 0)
{
HttpContext.Current.Response.Redirect("~/default/index.htm", false);
}
}
}
}
catch (ThreadAbortException tEx)
{
// Do nothing. ASP.NET is redirecting.
// Always comment this so other developers know why the exception
// is being swallowed.
Console.WriteLine(tEx.Message);
}
catch (Exception ex)
{
// Log other types of exception.
Console.WriteLine(ex.Message);
}
}
Любая помощь будет очень признательна.