开发者

Passing Forms Auth User credentials to SQL Server database connection

My web app is using .NET 3.5 framework, VS 2008 with a SQL Server database. I am usin开发者_开发百科g Forms authentication and the generic login to validate user access to the aspx pages. Is there a way I can pass the user's form auth credentials (different from their Windows login) to the sql server connectionstring so that their database permissions can be based on that login?


You could construct a connection string, inserting the Forms Authentication username and password (that you'll have to have saved somewhere). It's just simple string manipulation - have a connection string with placeholders for the username and password.

One disadvantage is that you won't be able to share pooled connections between different users, so won't benefit from connection pooling.

On a site with more than a handful of users this will quickly become a problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜