How to get windows log-in user name using vb.net code?

Hi,

I built an asp.net web application on our companies HR system so that recruitors can post jobs. Is there a way to get the windows logged in user name using vb.net code?

This user name is using for tracking who posted the job.

Thank you.

 

0
jenhu
3/6/2006 8:25:50 PM
asp.net.getting-started 91979 articles. 4 followers. Follow

2 Replies
4964 Views

Similar Articles

[PageSpeed] 30

Windows Authentication provides some options, as does forms authentication.  See if you get what you need through User.Identity.Name.  Take a look at:

http://www.15seconds.com/issue/020220.htm
http://aspnet.4guysfromrolla.com/articles/120705-1.aspx

Jeff


Please: Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue.
0
jeff
3/6/2006 9:01:58 PM

Dim win As System.Security.Principal.WindowsIdentity
win = System.Security.Principal.WindowsIdentity.GetCurrent()
Dim _UserName = win.Name.Substring(win.Name.IndexOf(
"\") + 1)

With the "IndexOf" stripping off the Domain name


"If you make it idiot proof, they'll build a better idiot"
0
MorningZ
3/6/2006 10:14:46 PM
Reply:

Similar Artilces:

Sending SMS using vb.net or C#.net using vb.net or c#.net
Hi  My requirement is I hav one csv file with these fields id,mobilenum,messgae,status.intiallu staus is 0. once i read the all fileds and take that mobile number.using tat mobile number  i need to send sms .after sending sms i shuld change status as 1 How to send sms thru coding (please dont provide any links.if it is provide also please give working links becox i checked codeproject .i didnt get any nice link. and also provide the how to update the status field im csv file   Thank ssandhya   To send SMS, you need some third party SMS providers. if you consul...

How to get the user name of a process in vb.net?
Could anybody tell meHow to get the user/owner name of a process in vb.net?The reason I need it is because I developed an application,which I will put on the winnt enviroment, I want to allow multiple instance.but only allow one single instance per user.I am using Application.Run(MyMainForm) to start my applicationThanks,Joseph...

used a c#.net to vb.net converter and am now getting a syntax error.
ok I used a cool utility at http://www.kamalpatel.net/ConvertCSharp2VB.aspx to convert some c#.net to vb.net and it spit out a bunch of code which almost works but I am getting a syntax error on this line Imports (StreamReader sr = Shadows Function)() As StreamReader(objResponse.GetResponseStream()) I tried it that way and also like Imports (StreamReader sr = Shadows Function)() As StreamReader(objResponse.GetResponseStream()) but either way gave the same error Compiler Error Message: BC30035: Syntax error. Source Error: Line 26: Line 27: Dim objResponse As HttpWebResponse = CType(objRequest.GetResponse(), HttpWebResponse) Line 28: Imports (sr = Line 29: Shadows Function)() As StreamReader(objResponse.GetResponseStream()) Line 30: result = sr.ReadToEnd() here is the orginal post with all of the source in both c#.net and vb.net http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=546706 I just ask you, what for? why do you need to convert a c# into vb if you can use both in a .net application?Best Regards, Thomas Crown. This posting is provided "AS IS" with no warranties. "If Debugging is harder than writing a program and your code is as good as you can possibly make it, then by definition you're not smart enough to debug it." That was changed from a "using (...) { }" statement. What was the C# code? That was defini...

use VB.NET and C#.NET code in the same C#.NET project
All-- Here is a sample that is "off the beaten path", (at least for me). Is it possible, in an ASP.NET application, using the code-behind page building technique, to have both pages written in VB.NET and pages written C#.NET?At http://www.WebLogicArts.com/DemoList.aspx there is a sample that shows that, (contrary to popular belief), it IS possible to mix ASP.NET pages built with C#.NET with ASP.NET pages built with VB.NET in the same VS.NET 2003 project. Note that this is just a "fun" sample to see if it can be done and I do not recommend this practice as a "standard" way of developing. The trick is to use the "Src" attribute of the @Page directive. Check out the link if you are inclined. You are welcome to download the code if you are interested further, found at the same link. (Note that the reason that I looked for a way to do this is because I wanted to have the option to include some VB.NET-based demos at my site. Since my site is a C#.NET ASP.NET, I was told that there was no want to do this. Therefore, I looked for a workaround and just happened to find one.) Enjoy (and then get back to work!) http://www.NetBrainer.com you are right !!!mixing languages could cause unknow and uncontrolled problems !!! if a developer has to mix ....the practical way is to create a new project with different language and what will be absolutely fine !!!thanks mkamoski for raising this issue !!Fadil Alnassar www.fadilalnassar.com | FREE Nodil Tab Controlhttp://www.mefranchisi...

get data from a html textbox and use that information in VB.NET code
Hello! Can anybody tell me how to get data from a html textbox and use that information in the coding of VB.NET. Actually I am working in SALT just like Bind Element Example, I would like that user speaks the data in and I use this data to be entered in a oracle database using VB.NET coding. Right now the data is not forwarding to the click event of aspx button from the html textbox. Can any body help me soon and early. I will be grateful. Haroon is the text box an asp:textbox or a plain old html input control? If either make sure that it is dimensioned in the codebehind if that i...

How to get RS (From VB6) to .NET (VB.NET)
Hi Friends,         I have requirement, there is one function in VB6 it returns a RS, I need to call that function in  VB.NET, how to get those values into .NET, if can any body can help (pass me some code snippets), that will be greate, Thank you.Madhu... -Madhu hey guys i got this one just by using fill method.-Madhu...

Getting first name and last name from Windows logged in user
 I'm sure there must be an easy way of getting the actual first name and last name from an Windows domain\username via the Windows Identity or Principal object, but I can't seem to figure it out. Does anyone have any examples of this? try this: HttpContext.Current.User.Identity.Name  Thanks - tried that...it returns nothing or domain\loginName :( Please check that on the site properties window (in IIS Admin console), in the security tab, click on the modify or edit button in the authentication and anonymous access group and make sure only the "Windows Inte...

Whan can i do? make "string" data type convert to "window" data type, and use a "window" name to get it ancestor "window name", thanks! i use pb5
Rich, With a string window name, you can open a window of that type if you need to. You could, of course, query that window object for any attributes. Another option is to use the LibraryExport function to export the definition of the window which is specified by the string. You can then parse the resulting file to get information on the ancestor object. HTH Sanjiv. "Rich" <windows_ce@netease.com> wrote in message news:2Xsr1WW0AHA.178@forums.sybase.com... > > > ...

Get Windows logged in user name
Hi,I have my own custom security module in my web application. I would like to implement signle sign on to my application. I was thinking to use mapping approach, which retrieve logged in window user name and "auto login" for him, retrieve his coressponding permission and etc.How could I retrieve windows logged in user name? Thank you     you can get the currently logged in user identity by using: WindowsIdentity ident = System.Security.Principal.WindowsIdentity.GetCurrent(); Now you can get the prinipals properties and groups and other useful stuff like th...

how to get CallerID using vb.net
Dear All!! does anyone know how to get the callerid of the incoming call using vb net or C# i have a telephone line connected with a modem, i need to answer the incoming call by getting the caller id information. Need assistance.     Hey,This forum is dedicated to asp.net which is a web based technology.As such we dont have access to this level of hardware through the browser. I am sure if anyone on here sees this post and they know the answer they will post it but you would probably get a better response if you want to the dedicated Windows Forms forums at:http://...

Get tokenGroups for user in VB.NET
Is there some sample code for checking to see if a user is in a particular tokenGroup on the Active Directory? I've found some examples in C#. Any in VB.NET? Thanks. I found some which use the "memberOf", but I've heard it's better to use the "tokenGroup". The advantage of using 'tokenGroups' is that it unravels all the group nesting for you.  Otherwise you would need recursion.You can write this code yourself fairly easily in VB.NET.  Simply get the 'objectSid' from your Group, and the 'tokenGroups' from your User.  Construct a SecurityIdentifier class in .NET 2.0 for eac...

How to get new web app to use .NET 2.0 on Win2K server using .NET 1.1 as default framework?
I have .net framework1.1 and 2.0 on our server running win2K. i have existing applications that uses asp.net 1.1, i also have a new app that use ASP.net 2.0.  how can i set my new .NET 2.0 app to point to asp.net 2.0 without messing up my existing .NET 1.1 apps? To specify the ASP .Net version fro a web application, do the followingIn IIS Manager select the web application -> Properties -> ASP.Net TabSelect  ASP.Net version you want to use for the applicationRegards,PrashantDont forget to click "Mark as Answer" on the post that helped you. But I am running Win2K which has IIS 5.0.  I do not see any default websites/virtual directories/ or any type of ASP.NET tab.  I just dont' know how to get my program to run using .NET framework 2.0. On win2k it is a mess sometimes to get this working, well first install .net framework 2.0 on the server, then see if iis mappings are correct. publish the website and then right click properties->select 2.0. from the dropdown.  Please Mark Post that helped you as answer, also include a summary of what solved the problem as it helps others in similar situations...

How to get Window account user ID from .NET?
Hi all, I would like to know that if .NET has functions/properties/API that I can programatically get Window NT/window user ID? Thanks a bunch for your help/response Are you talking about getting this information from an application? You could do this string _name = System.Security.Principal.WindowsIdentity.GetCurrent().Name; ...

How to get windows logged on os user name?
Hi,  In my old ASP.NET 1.1. code I have follwoing code in Page_Load of a certain page to get the os username if windows authentification checkbox is on in IIS 5.1 Session("OSUsername") = Request.ServerVariables("REMOTE_USER") Response.Redirect("subfolder2/subsubfolder3/TheSite.aspx")  Now I have migrated the code to ASP.NET 2.0 and the Server Variable REMOTE_USER is empty, although windows authentification checkbox is on !!!  How can I get OS username in ASP.NET 2.0? Background of the code above: Normally there is a logon page ...

Getting User Name using Windows Authentication
I'm not strong on terminology but I'll try. I imagine I'm using Windows Authentication since I'm able to access a SQLServer database using Trusted_Connection. Other than that no User Names or Passswords need be entered. How can I access some user information such as the users logon name? Thanks. if you want just name of logged in user this will give you. System.Web.HttpContext.Current.User.Identity.Name Jigar Desai-----------------------Do not forget to "Mark as Answer" on the post that helped you. The name comes back blank. Any more help? :: imagine...

how to get data from excel using vb.net
how to get data from excel using vb.net Hi, This article might help: http://authors.aspalliance.com/aldotnet/examples/excel.aspx Regards, How can obtain the sheet's list of a Excel document? here u can find the solution for your problem, mark if as answer if u problem got solved http://lakshmik.blogspot.com/2005/12/how-to-get-excel-data-into-net-dataset.html  Vyas Pentakotauniq_vyas@yahoo.com ...

code to get clients ip in Vb.NET
Dim host As System.Net.IPHostEntry        host = System.Net.Dns.GetHostByAddress(Request.ServerVariables.Item("REMOTE_HOST"))        Dim strComputerName As String = host.HostNameWith Thanks.,R.Chezhian.,=============================================Please Mark the helpful post(s) as Answered ...

how can i Get OCX File in .net IDE vb.net/C3
hi all,      How can I generate OCX file in VB.net/c# 2005 that will interact in web pages...?Thanks & Regards,Murthy. Hi murthysrn, As far as I know, VB 2005 and C# 2005 cannot create the project for ocx file. However, I hope the following link will be helpful to you. Creating an ActiveX Control in Visual Studio 2005http://msmvps.com/blogs/pauldomag/archive/2006/08/16/107758.aspxSincerely,Benson YuMicrosoft Online Community Support Please remember to mark the replies as answers if they help and unmark them if they provide no help. This can be beneficial to other co...

Translate c#.net code to vb.net code
Hi I can usually do the translation myself, but this time I am a bit stumped  Let us consider to rewrite Urls (more than 16000 links) using a table. Save original url and rewritten url in a table. Now add a class file in App_Code folder. class UrlRewriteModule : IHttpModule{    public void Dispose()    {        // Nothing to dispose    }    public void Init(HttpApplication context)    {        context.BeginRequest += new EventHandler(context...

How to convert C#.Net code to VB.Net code ???...
HI, i was searching something new, then i suddenly find some tips to convert C#.Net code to VB.Net but i did not do well. i am puttint its url here plz tell me how to convert C#.Net code to VB.Net. http://www.dotnetspider.com/code/C-273-Convert-C-VB-NET.aspx Jasim...Please remember to click “Mark as Answer” on the post that helps youJasim AkhtarNew Delhi ( INDIA ) It would be better if you write the problem you having, while converting from C# to VB.NET. You cannot completely rely on online converters. ThanksMark post(s) as "Answer" that helped youElectronic ScrewWebsite||Bl...

Converting classic to .NET 2 code, and .NET gets an error back from ADS?
 For future-proofing, our Internal Phone Directory is being moved onto our AD servers, and obviously we're using LDAP for queries.To get the phoneboook queries working, I adapted the current classic ASP code to use LDAP, and that works fine. However, we're wanting to move these pages to .NET, and that's where the problem comes in. Using the same basic logic from the Classic code (90% of its unchanged) to produce an LDAP query, I get the error  155 Unknown error (0x80005000)This is using the same website, and so the same credentials  - unless aspx pages run und...

Getting the windows user name without using impersonation
 Goals:Get the windows user name of the person requesting a pageUse a pre-defined system identity to run ASP.NET (Avoid using impersonation)Current setup:<authentication mode="Windows"/><identity impersonate="false"/>VS 2005Using WebDev.WebServer (although I've got the same problem with full IIS6)HttpContext.Current.User.Identity *always* returns the process identity. I want the user identity. I figured since I'm using Windows authentication, this should be a no-brainer.Help?  User.Identity.Name gets the windows user name of the person requ...

getting and modifying file properties using vb.net
i want my application to retrieve the information from the file`s property window as to when was the file created and when was it modified.... i also want to change these properties  how can i do that using visual basic 2005 classes ????? can some one help??? thanks in advanceaman Use the FileInfo class.Darrell Norton, MVPDarrell Norton's BlogPlease mark this post as answered if it helped you!...

Getting multiple errors
<Pages validateRequest="true" /> causes an error because of "validateRequest" is not a valid attribute <!-- %@ Page validateRequest="false" language="vb" CodeBehind="EditHtml.aspx.vb" AutoEventWireup="false" Inherits="ASPNET.StarterKit.Portal.EditHtml" % --> causes an error because of "validateRequest", again ...

Web resources about - How to get windows log-in user name using vb.net code? - asp.net.getting-started

Window - Wikipedia, the free encyclopedia
This article is about the part of a building. For the Microsoft operating system, see Microsoft Windows . For other uses, see Window (disambiguation) ...

Microsoft Windows Information, Solutions, Tools - Windows IT Pro
Microsoft Windows information and solutions for IT pros. Topics include cloud computing, Windows Server, Exchange, Outlook, PowerShell, virtualization, ...

The Windows Blog
The Windows Blog is Microsoft's Official Blog for the Windows Operating System.

Windows 10 Insider Preview Redstone Build 14279 arrives on the Fast ring, with a few noteworthy changes ...
... so the team doesn’t have to work over the weekend dealing with potential issues, Microsoft’s Gabe Aul pushed the button to release a new Windows ...

It’s time to ditch Windows
... we stop beating around the bush. Once upon a time the consumer desktop and laptop computer market was a two-horse town. You could buy a Windows ...

Microsoft is trying to bring back the eighties with its Windows 10 strategy
... Microsoft kept the rights in lieu of royalties from IBM. DOS put Microsoft the very center of the PC revolution, even through the era of Windows, ...

'It's prehistoric!' Today's teens react to Windows 95
Teens give Windows 95 a spin and learn about a time when dial-up Internet and patience were required to run a desktop computer.

Microsoft doesn’t need Windows anymore
When you think of Microsoft, what product first comes to mind? Windows, you say? How quaint. Yes, you’re probably reading this on a Windows-based ...

Super Meat Boy Wii U release window, port studio confirmed
Team Meat legend Tommy Refenes took to Twitter to spread the news that Super Meat Boy would be hitting the Wii U in the near future, as confirmed ...

Instagram beta arrives for Windows 10 mobile devices
Instagram first arrived on Windows mobile devices in beta form back in 2013. Today, the photographic social app is available for Windows 10 handsets, ...

Resources last updated: 3/7/2016 6:53:31 PM