0

Hi I am getting an Error while Inserting Record into databse while ruuning the Project from IIS and i will run through Visual Studio it is working well.

The INSERT permission was denied on the object 'tblPageInfo', database 'master', schema 'dbo'.

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.Data.SqlClient.SqlException: The INSERT permission was denied on the object 'tblPageInfo', database 'master', schema 'dbo'.

Source Error: 


Line 43:             string s = "insert into tblPageInfo values('" + PageName + "','" +   Url + "','" + PageTitle + "','" + CanonicalUrl + "','" + MetaDescription + "','" +   MetaKeyword + "','" + H1Text + "','" + H2Text + "')";
Line 44:             SqlCommand cmd = new SqlCommand(s, con);
Line 45:             cmd.ExecuteNonQuery();
Line 46:             con.Close();
Line 47:         }

Source File: D:\Kartik\Materials\CMS\CMS\AddPage.aspx.cs    Line: 45 
4

2 回答 2

2

您的网站将在没有权限的用户(应用程序池的权限)的上下文中运行,可能是 NetworkService 或类似的。解决方案是创建一个对您的数据库具有相关权限的用户,并在连接字符串中明确声明凭据。

关于不做什么的建议这样的。无论多么受诱惑,都不要向用户提供在这些权限下运行应用程序以使用集成安全性。这是不好的。

于 2013-02-27T13:42:20.970 回答
1

你在 web.config 中检查了 Visual Studio 和 IIS 中的连接字符串吗

于 2013-02-27T13:42:53.500 回答