Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在应用程序的几乎每个页面上,我都会根据当前登录的员工执行某些操作。除了在 Page_Load 中创建变量之外,还有更简单的方法来访问员工吗?
你必须照顾Session 类。
就我个人而言,我喜欢从一个接受某种员工 ID 值的类继承,尽管通常它是登录用户的 Windows 身份。
这将执行员工负载,并根据需要检索适当的属性或安全凭证。
这样可以确保详细信息是最新的,并且不会被其他用户轻易模仿。
您可以将内置的成员资格和身份验证提供程序与登录服务器控件结合使用来获得基本功能。