用户名! [英] username!

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

问题描述

大家好,

我正在使用网站,而且我正在使用身份验证。这段代码使

起作用:

Page.User.Identity.Name;但我的问题是它有这个

格式:Domain / Loginname,但我只想要Loginname。我该怎么办?
呢?

谢谢。

Hi all,
I''m working with website and I''m using Authentication. This code makes
it work:
Page.User.Identity.Name; But my problem is that it comes in this
format: Domain/Loginname, yet I only wanted Loginname. What should I
do?
Thanks.

推荐答案

3月26,上午11:58,rcoco < nclau ... @ yahoo.cawrote:
On Mar 26, 11:58 am, "rcoco" <nclau...@yahoo.cawrote:

大家好,

我正在与网站合作,我是使用身份验证这段代码使

起作用:

Page.User.Identity.Name;但我的问题是它有这个

格式:Domain / Loginname,但我只想要Loginname。我该怎么办?
呢?

谢谢。
Hi all,
I''m working with website and I''m using Authentication. This code makes
it work:
Page.User.Identity.Name; But my problem is that it comes in this
format: Domain/Loginname, yet I only wanted Loginname. What should I
do?
Thanks.



寻找斜线并取其余部分。

Look for a slash and take the rest of the string.


" rcoco" ; < nc ****** @ yahoo.cawrote in message

news:11 ********************** @ o5g2000hsb .googlegro ups.com ...
"rcoco" <nc******@yahoo.cawrote in message
news:11**********************@o5g2000hsb.googlegro ups.com...

我正在使用网站,我正在使用身份验证。这段代码使

起作用:

Page.User.Identity.Name;但我的问题是它有这个

格式:Domain / Loginname,但我只想要Loginname。
I''m working with website and I''m using Authentication. This code makes
it work:
Page.User.Identity.Name; But my problem is that it comes in this
format: Domain/Loginname, yet I only wanted Loginname.


我该怎么办?
What should I do?



一点点编程...


string strLoginName = Page.User.Identity.Name.Split(' '/'')[1];

A tiny bit of programming...

string strLoginName = Page.User.Identity.Name.Split(''/'')[1];


谢谢,

我收到此错误:索引超出了数组的范围。为什么

如此?

谢谢

Thanks,
I get this error: Index was outside the bounds of the array. Why is it
so?
Thanks


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

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