473,386 Members | 1,602 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to get the user name after FormAuthentication

hi,

I'm new to .aspx and want to ask a question about FormAuthentication.
I've created a login page and a default page, it works well in the login
page and can redirect to the default page. The problem is I want to get the
login name in the default page, what function should I use?

Thanks in advance.

Vivian
Sep 8 '06 #1
1 1128
hi Vivian,
User.Identity.Name will give you the username of the current user. this is
the generic 'Identity' object, which provides a basic set of information for
all the authentication types.

if your code is outside a code-behind file (i.e. outside a Page context),
you can use HttpContext.Current.User.Identiy.Name to get the same
information.

hope this helps
tim

"Vivian" <wk****@hotmail.comwrote in message
news:uJ**************@TK2MSFTNGP04.phx.gbl...
hi,

I'm new to .aspx and want to ask a question about FormAuthentication.
I've created a login page and a default page, it works well in the login
page and can redirect to the default page. The problem is I want to get
the login name in the default page, what function should I use?

Thanks in advance.

Vivian

Sep 8 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tom Loach | last post by:
Our system administrator set up an NT server group in order to allow our users to login to our application via https to our sql server. The group appears as a User in SQL Server when you look at...
2
by: Technical Group | last post by:
Friends, Can anybody help me out by sending a piece of C# code showing how to add an active directory user to a particular user group? If the group does not exist, then create it. Thanks in...
15
by: Tom Nowak | last post by:
I am writing a webapp in which a user is required to enter a login id and password on a login form. I have forms authenticaion coded in my web.config. Once the user is logged in, I want to use the...
5
by: Greg Cyrus | last post by:
Hi, i want to create a web-application and want to use a login for users. this login shall be controlled by a database. how can i assure that only logged in user can access-pages? I guess that...
4
by: Jamie Pollard | last post by:
hello, i have been scouring the groups for the best possible solution to this problem, but can't seem to find my exact scenario, so hopefully someone can get me back on the right path. my...
2
by: Johnnie Norsworthy | last post by:
ASP.NET 2.0 I can't seem to locate how to determine two simple things after I perform a FormAuthentication. From a subsequent page load, how do I determine if a user is authenticated already?...
6
by: Andrew Chalk | last post by:
My application attempts to connect to an SQL Server database as name ASPNET and Login Name SERVERNAME/ASPNET in response to these commands: SqlConnection myConnection = new SqlConnection("Data...
3
by: Terry Olsen | last post by:
I'm trying to add a domain user to a local group using the code below: Dim LCL As New DirectoryEntry("WinNT://" + Environment.MachineName + ",computer") Dim DOM As New...
14
by: chromis | last post by:
Hi, I've been trying to implement a more OOP oriented approach to dealing with user security on one of my websites, and I am trying to validate the user against an array of roles, however I am...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.