开发者

In ASP.Net site, how do I get name of the user that the person is signed in as?

I'm trying to put together a (real-life) game for my college campus and it'd be really easy if they just go to a website and click a button that says "Sign Me Up!" in which that button would send the username that person is signed in as (Since user names on our school laptops are always firstname.lastname). If there's no way I 开发者_JAVA百科can grab the person's username, is there a way I can prevent people from submitting multiple forms with more then just a cookie?


are you looking this...

HttpContext.Current.User.Identity.Name


Are you going to be able to host this site on your College's network? if you are, and you've enabled Windows Authentication rather than Forms Authentication then querying the Current user's Identity will "just work".

If you're going to have to host the site elsewhere, or on a different area of the college network (say a different domain), then using windows authentication won't provide the solution for you.

You'll need to create a simple registration page (you could easily use the standard registration wizard and login controls, talking to the default ASP.NET Membership database - see Introduction to Membership for more details).

In terms of limiting sign-ups to one per user, if you collect (say) a college or similar email address you can check those for uniqueness as well, and ensure that people are only signing up once (admittedly potentially per email address they have).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜