HttpContext.Current.User.Identity.Name的严重问题 [英] Serious issue with HttpContext.Current.User.Identity.Name

查看:60
本文介绍了HttpContext.Current.User.Identity.Name的严重问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个严重的问题似乎是断断续续的

User.Identity.Name。


在一个大约有100多个用户登录的环境中使用

表单进行身份验证,调用HttpContext.Current.User.Identity.Name

返回正确登录的用户。


然而,10%的时间(我猜是在压力条件下或

同时请求),正在返回错误的用户信息。


这个应用程序的逻辑:


1)用户输入用户名/通过

2)通过SQL DB调用查询信息

3)如果匹配,用户通过

FormsAuthentication.RedirectFromLoginPage(用户名,True)进行身份验证

4)在用户访问的所有页面上,他/她的信息通过电话显示

到HttpContext.Current.User.Identity.Name


几乎所有时间都有效。任何想法为什么它可能会不时地从b
失败?

解决方案

通常是编码错误的地方你将用户信息存储在一个vb模块中,或者在页面处理过程中将其存储在c#

中。


- bruce(sqlwork.com)


< ki ********* @ hotmail.com>在留言中写道

news:11 ********************** @ f14g2000cwb.googlegr oups.com ......

|我有一个严重的问题似乎是间歇性的

| User.Identity.Name。

|

|在大约100多个用户使用

|登录网站的环境中表单身份验证,调用HttpContext.Current.User.Identity.Name

|返回正确登录的用户。

|

|但是,有10%的时间(我猜是在压力条件下或

|同时请求),正在返回错误的用户信息。

|

|这个应用程序的逻辑:

|

| 1)用户输入用户名/通过

| 2)通过SQL DB调用查询信息

| 3)如果匹配,用户通过

|进行身份验证FormsAuthentication.RedirectFromLoginPage(用户名,True)

| 4)在用户访问的所有页面上,通过电话显示他/她的信息

|到HttpContext.Current.User.Identity.Name

|

|这几乎一直都有效。任何想法为什么它可能会失败

|不时?

|


布鲁斯,


感谢您的回复。

能否请给我更多详细信息?


当您说编码错误存储用户信息时,
$ b $是什么这里常见的错误是什么?


我们不会在任何地方存储该信息,只需在需要该信息时调用

HttpContext.Current.User.Identity.Name 。

有时它是正确的,有时它不是。


Kiran


布鲁斯,


感谢您的回复。

您能告诉我更多细节吗?


当你说编码错误你存储用户信息的地方时,这里的

常见错误是什么?


我们不存储该信息任何地方,但只要我们需要那些信息,只需要调用

HttpContext.Current.User.Identity.Name。

有时它是正确的,有时它是'不是。


基兰


I have a serious issue that seems to be intermittent with
User.Identity.Name.

In an environment where about 100+ users are logging on to a site with
forms authentication, calling HttpContext.Current.User.Identity.Name
returns the correctly logged on user.

However, 10% of the time (I''m guessing under stress conditions or
simulataneous requests), the wrong user info is being returned.

The logic of this app:

1) User enters username/pass
2) Info is looked up via SQL DB call
3) If match, user is authenticated via
FormsAuthentication.RedirectFromLoginPage(username , True)
4) On all the pages the user visits, his/her info is shown via a call
to HttpContext.Current.User.Identity.Name

This works almost all the time. Any ideas why it might be failing from
time to time?

解决方案

usually a coding error where you store the user info in a vb module or c#
static during page processing.

-- bruce (sqlwork.com)

<ki*********@hotmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
| I have a serious issue that seems to be intermittent with
| User.Identity.Name.
|
| In an environment where about 100+ users are logging on to a site with
| forms authentication, calling HttpContext.Current.User.Identity.Name
| returns the correctly logged on user.
|
| However, 10% of the time (I''m guessing under stress conditions or
| simulataneous requests), the wrong user info is being returned.
|
| The logic of this app:
|
| 1) User enters username/pass
| 2) Info is looked up via SQL DB call
| 3) If match, user is authenticated via
| FormsAuthentication.RedirectFromLoginPage(username , True)
| 4) On all the pages the user visits, his/her info is shown via a call
| to HttpContext.Current.User.Identity.Name
|
| This works almost all the time. Any ideas why it might be failing from
| time to time?
|


Bruce,

Thanks for the reply.
Can you please give me more detail?

When you say "coding error where you store the user info", what is the
common error here?

We are not storing that info anywhere, but just calling
HttpContext.Current.User.Identity.Name whenever we need that info.
Sometimes it''s correct, sometimes it''s not.

Kiran


Bruce,

Thanks for the reply.
Can you please give me more detail?

When you say "coding error where you store the user info", what is the
common error here?

We are not storing that info anywhere, but just calling
HttpContext.Current.User.Identity.Name whenever we need that info.
Sometimes it''s correct, sometimes it''s not.

Kiran


这篇关于HttpContext.Current.User.Identity.Name的严重问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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