如何使用LINQ实现编程模拟? [英] How do you implement programmatic impersonation with LINQ?

查看:74
本文介绍了如何使用LINQ实现编程模拟?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

全部,

我试图在我的ASP.NET应用程序中使用Windows集成身份验证来访问我们的SQL Server后端。我对如何仅为LINQ数据库访问这样做感到难过。我需要我的ASP.NET应用程序的其余部分在默认的NetworkService帐户的上下文中运行。

如何让LINQ使用模拟打开其SQLConnection?在打开连接时是否有可以访问的受保护方法或拦截事件?

All,

I am attempting to use Windows Integrated Authentication in my ASP.NET application to access our SQL Server backend.  I am stumped on how to do this only for the LINQ database access.  I need the rest of my ASP.NET application to run in the context of the default NetworkService account.

How do you get LINQ to open its SQLConnection using impersonation?  Are there any protected methods you can access or events to intercept when the connection is opened?

推荐答案

EZ方式:模拟用户,打开连接,存储它,并将该连接传递给L2S DataContext构造函数。
E-Z way: Impersonate the user, open a connection, store it, and pass that connection to the L2S DataContext constructor.


这篇关于如何使用LINQ实现编程模拟?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆