我已经使用 Visual Studio 默认网站创建了一个应用程序。它在本地机器上运行良好,但是当我将它托管在服务器 iis 上时。它给出了错误
Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'.
在我的数据库中没有这样的 sp,我也不想使用会员提供程序。所以我试图从 web.config 中删除本地连接,但仍然没有运气。
<remove name="LocalSqlServer" />
<clear />
<add name="LocalSqlServer" connectionString="Data Source=GGT\NNY;Initial Catalog=VersionControl;User ID=sa;Password=123" providerName="System.Data.SqlClient"/>
<add name="ConVersionControl" connectionString="Data Source=GGT\NNY;Initial Catalog=VersionControl;User ID=sa;Password=123" providerName="System.Data.SqlClient"/>
转换控制
是我在我的应用程序中使用的连接
以下是我用于登录的代码
protected void LoginButton_Click(object sender, EventArgs e)
{
try
{
dtUserDetails = new DataTable();
if (UserRepositoryBL.ValidateUser(LoginUser.UserName.Trim(), LoginUser.Password.Trim(), out dtUserDetails))
{
AuthUser au = new AuthUser();
if (dtUserDetails.Rows.Count > 0)
{
DataRow DR = dtUserDetails.Rows[0];
au.UserID = Convert.ToInt32(DR["UserID"].ToString());
au.UserNo = DR["UserNo"].ToString();
au.UserName = DR["UserName"].ToString();
au.Password = DR["Password"].ToString();
}
string userData = au.ToString();
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
1, // Version number
LoginUser.UserName.Trim(), // Username
DateTime.Now, // Issue date
DateTime.Now.AddMinutes(60), // Expiration date
false, // Persistent?
userData // User data
);
string eticket = FormsAuthentication.Encrypt(ticket);
HttpCookie cookie = new HttpCookie
(FormsAuthentication.FormsCookieName, eticket);
Response.Cookies.Add(cookie);
BasePage.ActivityLog("User Login", LoginUser.UserName.Trim(), true, Request.RawUrl);
string url = FormsAuthentication.GetRedirectUrl(LoginUser.UserName, false);
Response.Redirect(url);
}
else
{
LoginUser.FailureText = "Your login attempt was not successful. Please try again.";
}
}
catch (Exception ex)
{
throw ex;
}
}
请注意,应用程序可以正常登录成功。仅当我尝试使用无效的用户名或密码登录时才会出现上述错误