C# - Get UserName In Web App?

Mar 7, 2011

I have an ASP.net app which is being hosted on a server. I want to get the Clients username from the system and use that name as a title for an XML file im saving on the server. I have tried various different mathods such as:

Environment.UserName();
WindowsIdentity.GetCurrent();

However all that keeps returning is the NetworkService account name on the server.

View 5 Replies


Similar Messages:

Security :: Update Username Of Current Logged Username?

Mar 12, 2010

How to update username of current logged username?

View 10 Replies

MVC - Get Username From URL

Oct 31, 2010

Is there any way to retrieve username from this [URL] type of address in ASP.NET MVC (optionally in ASP.NET) from current request?

View 2 Replies

How To Display Username

Jun 3, 2010

I want to display the username using a label that is logged in using the default login script that comes with asp. How can I do that? In visual basic it's "label.text = textbox1.text" or something like this.

View 10 Replies

How To Edit And Change The Username

Dec 8, 2010

I'm doing a asp.net web application.

I wish to create a function for Administrator to be able to edit and change the Username of the user that the Administrator had created previously using Create User Wizard.

View 1 Replies

Security :: Get UserId From UserName C#?

Jul 31, 2010

I am setting up membership and rolls for a small forum site that im working on. All this info is stored in the standard aspnetdb database. When a user is logged in and saves a post to the forum, their UserId is saved to a database in unique identifier format such as: b40e346d-0399-4bbb-90ee-c7c440726cfd. I want to set up a web service so that the name of the author of each post can be clicked on to retieve details about him or her. Rather than passing along the UserId of the author to the web service, I want to pass along the UserName and use that to retrieve the user's Id, which will in turn be used to query the database. I cant seem to find info on how to do this. I can find how to retrieve this kind of info for the current logged in user, but not any or all users in general.

View 5 Replies

C# - Getting Windows Username With JavaScript?

Jun 10, 2010

I have a site which is built in ASP.net and C#. Let's call it webapp. it uses a Form system to log on into it, and cannot be changed easliy.

I got a request to change the log in to some kind of windows authentication. I'll explain. Our windows login uses active directory for users to log into their windows account. their login name is sXXXXXXX. X are numbers. in my webapp, I want to take the users numbers from their active directory login, and check if those exist in the webapp database. if it exists, they will automatically log in. If it doesn't, they will be referred to the regular login page for the webapp system which is currently in use.

I tried changing my IIS to disable anonymous login and enabling windows authentication, therefore making the user browser to send it's current logged in user name to my webapp. I changed the web config as well from "Forms" to "Windows", which made my whole webapp obsolete as the whole forms system did not work.

My question is this - is there a different way for the browser only to send the username to my webapp? I thought maybe javascript, I just don't know how to implement that, if it's even possible. I know it's not very secure, but all this platform and system is built outside the internet, it's on a private network.

View 3 Replies

Displaying Username After Logged In?

Sep 21, 2010

I having problem in display the username after a user logged in.This is my master page which has label which named Label1 on top right, i want to display the username on there after logged in.

View 4 Replies

C# - Use Process.StartInfo.UserName?

Jan 28, 2011

I have a website that has a linkbutton that opens a game :

Process game= new Process();
game.StartInfo.FileName = HttpContext.Current.Request.MapPath("~/iFarkle.exe");
game.StartInfo.UserName = Session["Username"].ToString();
game.StartInfo.UseShellExecute = false;
game.Start();

How do I use the StartInfo.UserName? (it doesn't work right now, it stays I entered bad data)(works without the StartInfo.UserName

View 1 Replies

Username Validation Using C# Code?

Oct 8, 2010

I wnat to check "UserName" input with for the following conditions using C#, must Srating with alpha numeric character length is 6 to 15 chars do not use more than 5 numeric characters do not use any special characters.

View 2 Replies

C# - Check If A Username Has Been Registered?

Jun 18, 2010

I am using the builtin ASP.NET logon and user management features. Is there a way to just identify if a username or email address is already registered? I would've thought it's part of FormsAuthentication or similar, but can't find such a function.

View 2 Replies

Security :: Get Username From Email?

Mar 10, 2011

i am using .net membership. How can i get username from email address?

View 3 Replies

C# - GetRolesForUser Tries To Get Roles On Old Username?

Mar 24, 2010

I have a section on a page where a user can change their username. This is basically the code for that:

user.UserName = txtNewUserName.Text;
user.Save();

user is a class in my dbml and Save calls SubmitChanges on the data context.The name is changed in the database, so when it calls the following method, it fails because it is trying to get the user with the old username instead of the one that is in the database now.

public override string[] GetRolesForUser(string username)
{
return dc.Users.Where(u => u.UserName== username)
.SingleOrDefault().Roles
.Select(r => r.RoleName).ToArray<string>();
}

View 1 Replies

Web Forms :: Can't Get Username And Ip In Iis7

Nov 9, 2010

i develop webpage to get the username and password for user who browse this page the logined user in pc.

ex. i login to my pc with domainwael as username and i have ip when i run this page on my pc inside VS2008 it is ok give me this information but when i published on proudaction server with win 2008 and iis7 64bit it not give me this information

the code that i used for retrive the username and ip is:

[Code]....

View 3 Replies

.net Create Membership Without Username?

Mar 4, 2011

probabaly a daft question but when creating a user using .net membership, can i exclude the username and just have the email as the 'username' like this?

Membership.CreateUser(model.UserName, model.Password, model.Email, ....

or leave blank...

Membership.CreateUser("", model.Password, model.Email, ......

View 2 Replies

Security :: Using One Username To Log Into Two Different Sites?

Apr 8, 2010

I have two websites that run on two different servers and they both both have their own asp membership databases. One is http:// and one is https://. Is it possible to create a way that a user can access both websites while only entering username and password once? Or if the user logs onto the https site can I then redirect to the http site and auto authenticate?

View 3 Replies

Twitter-like @Username Link?

Mar 19, 2010

How would I be able to achieve this; The user enters a username (@Username) and it will create a link to Profile.aspx?view=Username ?

View 1 Replies

C# - Capture Username With Log4net?

Jan 27, 2011

I currently write all log4net events to a database, and it seems to work just fine. To capture the logged in user account I use this piece of code:

HttpContext context = HttpContext.Current;
if (context != null && context.User != null && context.User.Identity.IsAuthenticated)
{
MDC.Set("user", HttpContext.Current.User.Identity.Name);
}

The code seems ok, except for events that have no user context associated with them (ie. a user on our public web page). In that case the log4net capture seems to sometime write the last logged in user account (bad) and sometime write a null (good). Anyone got this feature to work reliably in all cases? I believe I saw a note that MDC is no longer a recommended feature to use, but I wasn't able to find any alternatives that are recommended.

Note: I find it odd that MDC is set with an account name, but never cleared if no user is active. That could be part of the problem. However, I didn't find any MDC code extracts that also clear the username.

View 3 Replies

Getting DomainName\UserName From A Web Request?

Mar 19, 2011

I am developing a intranet application.I am getting domainname\username details with

HttpContext.User.Identity.Name but the problem is when i disable windows authentication it;s not returning any value.

How to get the domainname\username details irrespective of the client request originating from windows or linux.

what is Iprinciple and can we get domainname\username details from Iprinciple.

View 5 Replies

Security :: Get Username From UserId?

Nov 16, 2010

How do I get the UserName from UserId by the following code?

[Code]....

View 2 Replies

Get .Net Username From SQL Server 2008?

Mar 24, 2010

With windows and sql server accounts, I can access the logged in user with functions like: user_name() or suser_sname().Can I access the user that is logged into asp.net in the same way?

View 1 Replies

Checking Username Availability?

Jan 12, 2010

I need to check the username availability like twitter.com (https://twitter.com/signup) in asp.net/c# 3.5 with AJAX concept. How to do this?

View 2 Replies

C# - Get The Username In Forms Authentication?

Feb 10, 2011

I'm using Forms authentication.In Windows Authentication for get the user name of the PC i use: User.Identity.Name

I need this information also in Forms authentication but User.Identity.Name doesn't work.How can I get the User.Identity.Name without using Windows authentication?

View 3 Replies

.net - Get Username In Global Asax?

Jun 29, 2010

I am trying to check if the user belongs to someone's friendlist from the database and redirect him accordingly.I am doing this in a routehandler called by Global Asax.I just want to know how to get the username (from the login information) in the route handler class (or Global asax)I used this: string username = HttpContext.Current.User.Identity.Name; and very strangely, its assigning ".aspx" as the username!! ps: i did search for similar question but in vain.

View 1 Replies

Validation Expression For UserName Using C#?

Sep 27, 2010

I am developing a login form with User Name and Password. I want the user to create the username in a specified format. So i am using RegularExpressionValidator for the username. What is the Validation Expression for this format.

The format is:

xyz\t4z4567 (characters are not case sensitive)

Rules:

The username will be created in the above format. first 5 characters(xyz) are same for every username with the slashes. Only "t4z4567" will be changed for every user.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved