Environment.UserName [英] Environment.UserName

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

问题描述

我正在使用Visual Studio 2003,.NET 1.1开发一个Web应用程序,以便在我们的Intranet上运行

。我想识别用户以保存他们登录。


行:


UserName = Environment.UserName

返回ASPNET,而不是我的用户名。


我已阅读所有帮助文档,但我找不到任何理由为何

不工作。


我错过了参考或导入吗?我添加了对

System.Security.dll的引用。我的进口是:


进口系统


进口System.Configuration


Imports System.Security .Principal


进口System.Security.Permissions


进口System.Threading


谢谢你你的帮助,


海伦

I am developing a web application in Visual Studio 2003, .NET 1.1 to run on
our intranet. I want to identify users to save them logging in.

The line:

UserName = Environment.UserName

is returning "ASPNET", instead of my user name.

I have read all the Help documentation, but I can''t find any reason why this
isn''t working.

Am I missing a reference or import? I have added a reference to
System.Security.dll. My imports are:

Imports System

Imports System.Configuration

Imports System.Security.Principal

Imports System.Security.Permissions

Imports System.Threading

Thanks for your help,

Helen

推荐答案

如果您尝试使用System.Web.HttpContext.Current.User怎么办?相反.Identity.Name?


System.Environment与服务器端Windows进程相关,而不是网络连接的IIS上下文。 ..


-

Patrice


" Helen Trim" <他******* @discussion.microsoft.comaécritdansle message

de groupe de discussion:
3C ************** ********************@microsoft.com ...
What if you try System.Web.HttpContext.Current.User.Identity.Name instead ?

System.Environment is rather related to the server side Windows process
rather than to the IIS context for a web connexion....

--
Patrice

"Helen Trim" <He*******@discussions.microsoft.coma écrit dans le message
de groupe de discussion :
3C**********************************@microsoft.com...

我正在开发Visual Studio 2003中的Web应用程序,.NET 1.1在我们的Intranet上运行

。我想识别用户以保存他们登录。


行:


UserName = Environment.UserName

返回ASPNET,而不是我的用户名。


我已阅读所有帮助文档,但我找不到任何理由

这个

不起作用。


我错过了参考或导入吗?我添加了对

System.Security.dll的引用。我的进口是:


进口系统


进口System.Configuration


Imports System.Security .Principal


进口System.Security.Permissions


进口System.Threading


谢谢你你的帮助,


Helen
I am developing a web application in Visual Studio 2003, .NET 1.1 to run
on
our intranet. I want to identify users to save them logging in.

The line:

UserName = Environment.UserName

is returning "ASPNET", instead of my user name.

I have read all the Help documentation, but I can''t find any reason why
this
isn''t working.

Am I missing a reference or import? I have added a reference to
System.Security.dll. My imports are:

Imports System

Imports System.Configuration

Imports System.Security.Principal

Imports System.Security.Permissions

Imports System.Threading

Thanks for your help,

Helen



Hello Patrice


感谢您的回复。我尝试了这个,但它给了我一个空字符串。


还有更多想法吗?


问候

Helen

" Patrice"写道:
Hello Patrice

Thanks for your reply. I tried this, but it gave me an empty string.

Any more ideas, please?

Regards
Helen
"Patrice" wrote:

如果你尝试使用System.Web.HttpContext.Current.User.Identity.Name怎么办?


系统。环境与服务器端Windows进程相关,而不是网络连接的IIS上下文....


-

Patrice


" Helen Trim" <他******* @ discussion.microsoft.coma crit dans le message

de groupe de discussion:
3C ************** ********************@microsoft.com ...
What if you try System.Web.HttpContext.Current.User.Identity.Name instead ?

System.Environment is rather related to the server side Windows process
rather than to the IIS context for a web connexion....

--
Patrice

"Helen Trim" <He*******@discussions.microsoft.coma crit dans le message
de groupe de discussion :
3C**********************************@microsoft.com...

我正在开发Visual Studio 2003中的Web应用程序,.NET 1.1在我们的Intranet上运行

。我想识别用户以保存他们登录。


行:


UserName = Environment.UserName

返回ASPNET,而不是我的用户名。


我已阅读所有帮助文档,但我找不到任何理由

这个

不起作用。


我错过了参考或导入吗?我添加了对

System.Security.dll的引用。我的进口是:


进口系统


进口System.Configuration


Imports System.Security .Principal


进口System.Security.Permissions


进口System.Threading


谢谢你你的帮助,


Helen
I am developing a web application in Visual Studio 2003, .NET 1.1 to run
on
our intranet. I want to identify users to save them logging in.

The line:

UserName = Environment.UserName

is returning "ASPNET", instead of my user name.

I have read all the Help documentation, but I can''t find any reason why
this
isn''t working.

Am I missing a reference or import? I have added a reference to
System.Security.dll. My imports are:

Imports System

Imports System.Configuration

Imports System.Security.Principal

Imports System.Security.Permissions

Imports System.Threading

Thanks for your help,

Helen





ASPNET是默认的用户名。 ASP.Net进程使用

登录IIS服务。


与浏览页面的用户无关。

问候,


Joergen Bech


2008年6月4日星期三07:55:01 -0700,Helen Trim

< He ******* @ discussion.microsoft.comwrote:

ASPNET is the default "user name" the ASP.Net process uses
to log into the IIS service.

Nothing to do with the user browsing your pages.

Regards,

Joergen Bech

On Wed, 4 Jun 2008 07:55:01 -0700, Helen Trim
<He*******@discussions.microsoft.comwrote:

> Hello Patrice

感谢您的回复。我尝试了这个,但它给了我一个空的字符串。

还有更多的想法吗?

问候
Helen

"帕特里斯"写道:
>Hello Patrice

Thanks for your reply. I tried this, but it gave me an empty string.

Any more ideas, please?

Regards
Helen
"Patrice" wrote:

>如果你尝试使用System.Web.HttpContext.Current.User.Identity.Name怎么办?

System.Environment与服务器端的Windows进程相关,而不是与网络连接的IIS上下文相关....

-
Patrice

Helen Trim <他******* @ discussion.microsoft.coma crit dans le message
de groupe de discussion:
3C ****************** ****************@microsoft.com ...
>What if you try System.Web.HttpContext.Current.User.Identity.Name instead ?

System.Environment is rather related to the server side Windows process
rather than to the IIS context for a web connexion....

--
Patrice

"Helen Trim" <He*******@discussions.microsoft.coma crit dans le message
de groupe de discussion :
3C**********************************@microsoft.com...

我正在开发一个Web应用程序Visual Studio 2003,.NET 1.1在我们的Intranet上运行

。我想识别用户以保存他们登录。


行:


UserName = Environment.UserName

返回ASPNET,而不是我的用户名。


我已阅读所有帮助文档,但我找不到任何理由

这个

不起作用。


我错过了参考或导入吗?我添加了对

System.Security.dll的引用。我的进口是:


进口系统


进口System.Configuration


Imports System.Security .Principal


进口System.Security.Permissions


进口System.Threading


谢谢你你的帮助,

Helen
I am developing a web application in Visual Studio 2003, .NET 1.1 to run
on
our intranet. I want to identify users to save them logging in.

The line:

UserName = Environment.UserName

is returning "ASPNET", instead of my user name.

I have read all the Help documentation, but I can''t find any reason why
this
isn''t working.

Am I missing a reference or import? I have added a reference to
System.Security.dll. My imports are:

Imports System

Imports System.Configuration

Imports System.Security.Principal

Imports System.Security.Permissions

Imports System.Threading

Thanks for your help,

Helen



这篇关于Environment.UserName的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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