我有一个 asp.net 网站和一个班级图书馆作为项目参考。 在班级图书馆里, 我有一个公共类的静态方法。 当用户登录到他们的账户时, 我给一个静态方法打电话, 以装入与用户有关的信息。 我有一些例子, 我登录到用户 A 时, 我能看到与用户 B 有关的信息。 这是因为静态方法吗?
What is the use of default keyword in C#? Is it introduced in C# 3.0 ?
我有一个 asp.net 网站和一个班级图书馆作为项目参考。 在班级图书馆里, 我有一个公共类的静态方法。 当用户登录到他们的账户时, 我给一个静态方法打电话, 以装入与用户有关的信息。 我有一些例子, 我登录到用户 A 时, 我能看到与用户 B 有关的信息。 这是因为静态方法吗?
否, 是因为静态 变量 。 这些由整个 AppDomain
共享 - 这几乎意味着“ 机器上的整个网站 ” 。
很难确切地知道在没有任何更多信息的情况下你应该做什么,但我强烈怀疑你只是将用户信息储存在静态变量中,这就是`它们'永远不会是正确的方式。
您如何管理用户会话由您决定, 并且毫无疑问, 已经为此撰写了文字的重写- 但使用静态变量将引发您所看到的问题 。
这可能是,我不得不看你的代码是肯定的,信息是否也作为静态存储起来?那么,它是正确的,因为静态在两种情况之间是共享的。
What is the use of default keyword in C#? Is it introduced in C# 3.0 ?
I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...
I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...
I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...
I have two EF entities. One has a property called HouseNumber. The other has two properties, one called StartHouseNumber and one called EndHouseNumber. I want to create a many to many association ...
How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...
Since I cannot order my dictionary, what is the best way of going about taking key value pairs and also maintaing an index?
Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...