Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
当您想登录时,它会显示错误页面web asp.net c#_C#_Asp.net_Webforms - Fatal编程技术网

当您想登录时,它会显示错误页面web asp.net c#

当您想登录时,它会显示错误页面web asp.net c#,c#,asp.net,webforms,C#,Asp.net,Webforms,当我想通过谷歌浏览器登录我的项目时,它会显示这个错误 } 这是我的login.asp代码,或者我不知道为什么它不允许我登录数据库是sql我也将数据库添加到项目中,但当我想登录时,它显示错误我不知道我必须编辑哪个文件我希望任何人能向我解释一下如果没有相关代码,就无法回答您的问题。请将您的代码添加到问题中。在我们帮助你之前,我们需要一个新的解决方案。还有,为什么你怀疑这与你的web.config和你的连接字符串有关?好吧,我错了,你能帮我吗?我将发布登录代码OK。我询问了您的web.config,

当我想通过谷歌浏览器登录我的项目时,它会显示这个错误

}


这是我的login.asp代码,或者我不知道为什么它不允许我登录数据库是sql我也将数据库添加到项目中,但当我想登录时,它显示错误我不知道我必须编辑哪个文件我希望任何人能向我解释一下

如果没有相关代码,就无法回答您的问题。请将您的代码添加到问题中。在我们帮助你之前,我们需要一个新的解决方案。还有,为什么你怀疑这与你的web.config和你的连接字符串有关?好吧,我错了,你能帮我吗?我将发布登录代码OK。我询问了您的web.config,因为对我来说,您收到的错误消息似乎更多地与标记或javascript相关,而不是与实际的服务器代码相关。例如,您是否正在尝试向页面动态添加控件?也许显示一些标记也会有所帮助……我已经显示了您的webconfig和代码
    Server Error in '/' Application.
Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentException: Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[ArgumentException: Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.]
   System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument) +9851830
   System.Web.UI.WebControls.TextBox.LoadPostData(String postDataKey, NameValueCollection postCollection) +126
   System.Web.UI.WebControls.TextBox.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +15
   System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +457
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1833

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.2633.0
<connectionStrings>
    <!--<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>-->
    <add name="PointofSaleConstr" connectionString="Data Source=(local); Initial Catalog=Pointofsale; User ID=posadmin;Password=posadmpw" providerName="System.Data.SqlClient"/>

</connectionStrings>
protected void btnSubmit_Click(object sender, EventArgs e)
{
    string UserID = txtuser.Text.Trim();
    string pass = txtpass.Text.Trim();

    string strcon = ConfigurationManager.ConnectionStrings["PointofSaleConstr"].ConnectionString;
    SqlConnection con = new SqlConnection(strcon);

    SqlCommand cmd = new SqlCommand("Sp_User_Authentication", con);
    cmd.CommandType = CommandType.StoredProcedure;

    cmd.Parameters.AddWithValue("@LOGINID", UserID);
    cmd.Parameters.AddWithValue("@PASSWORD", pass);       
    con.Open();

    SqlDataReader rd = cmd.ExecuteReader();
    if (rd.HasRows)
    {
        rd.Read();
        lblLogMsg.Text = "Login successful.";

           // //Session to Master Page                
           //Session["UserID"] = UserID;
          // Session["ShopID"] = rd["ShopID"].ToString();

           Response.Cookies["POSCookies"]["UserID"] = UserID;
           Response.Cookies["POSCookies"]["ShopID"] = rd["ShopID"].ToString();
           Response.Cookies["POSCookies"].Expires = DateTime.Now.AddDays(9965);

            hitcounter();
            Response.Redirect("Dashboard/Default.aspx", false);

            //Query string
           //  Response.Redirect("Default.aspx?userID=" + UserID + "&ShopID=" + rd["ShopID"].ToString());
           // Response.Redirect("Default.aspx?userID=" + HttpUtility.UrlEncode(Request.QueryString["UserID"]) + "&ShopID=" + rd["ShopID"].ToString());
    }
    else
    {
        lblLogMsg.Visible = true;
        lblLogMsg.Text = "We don't recognize this user ID or password.";
    }
    con.Close();
}
 public void hitcounter()
{
    try
    {          
        string ip = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];

        SqlConnection cn = new SqlConnection(ConnectionString);

        SqlCommand cmd = new SqlCommand("SP_POS_Insert_HitCounter", cn);
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.AddWithValue("@userID", txtuser.Text);
        cmd.Parameters.AddWithValue("@IPaddress", ip);

        cn.Open();
        cmd.ExecuteNonQuery();
        cn.Close();
    }
    catch
    {
    }
}