Get a user's logon id from javascript

Hey all,
Damn, I signed up because I wanted an answer, and I can't friggin search (without paying for it, anyway)!!

I'm not scrolling through 18000 questions to see if one is related to mine (and yes, I did google for this first).

The closest thing I found was this (for PERL)
http://www.experts-exchange.com/Programming/Programming_Languages/Perl/Q_20037058.html

Can I do something similar with Javascript.
See, I'm working on a web-site which will only be on the intranet.  I would like to be able to get the user's logon id from WinNT (or anywhere if there is a more cross-platform solution).

Thanks for any help everyone,
Radish21
Radish21Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Radish21Author Commented:
Damn it, this always happens.  I (finally) found something more relevant here:
http://www.experts-exchange.com/Web/Web_Languages/JavaScript/Q_20467492.html

So, is that the accepted way?  Can't be done??

That sucks....
0
whammyCommented:
Can you use ASP/VBScript? I know you can use VBScript since you're on an intranet... but for a website you would have to have IIS installed on the server (not a biggie if you're using a Windows platform).

P.S. Chill out man! ;-)

0
Radish21Author Commented:
Mate, I don't even know what ASP stands for (or IIS for that matter).  I know ABSOLUTELY nothing about any of those.  I'm a work-experience (uni) student, out of my field.

I was just wondering if there was a nice, easy Javascript command to do it (I know Java, and Javascript isn't too different, plus I was already using Javascript for a feedback form).

I wouldn't have a clue what the web-server is running.  The web-master won't return my emails :)

Anyway, I think the concensus is that it can't be done with javascript, and although it can be done, it's not easy.

Thanks for the reply anyway.

Cheers,
Radish21
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

m8rixCommented:
Radish21 It definatly cannot be done using Javascript.

May be possible using ASP (Active Server Pages) or JSP (JavaServer Pages) or various other Server side scripting.

Reg's
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Radish21Author Commented:
Bit hard to rate a question as excellent when it tells you that you can't do something.  But hey, it couldn't really have been more truthful, huh?
0
m8rixCommented:
Beleive me... I know how you feel ;)
0
ijeCommented:
Radish mate, I know exactly how you feel.

Javascript can't get the user's logon id itself - but it can be used with Window's Script Host to get it (if it's installed). Give this code a go - if it works, it's installed and it works - if not - haven't lost anything.

Just cut all this code, then open it up to see if you userid shows up:
_________________________________________________________

<html>
<head>
<script>
var WSHNetwork  = new ActiveXObject("WScript.Network");
var UserName = WSHNetwork.UserName;
</script>
</head>
<body>
<script>
document.write(UserName)
</script>
</body>
</html>
__________________________________________________________

P.S. You've gotta be an Australian ;)
0
Radish21Author Commented:
I got back undefined.  Thanks for the try though.

Bloody oath I'm a dinky-di aussie, true-blue through and through mate!

It's the starting off sentences with Mate, isn't it?

ije I would have picked you as one too, except you say Australian rather than aussie... perhaps you've been here a few times?  Learnt the lingo?
0
ijeCommented:
I'm an Aussie (from the country - stuck in Melbourne)- I try to use 'proper English' in these sorts of places cause you could be dealing with people that have a pretty good idea about JavaScript and stuff, but have a hard time figuring out what I'm saying....

Anyway - one thing I don't like about this place is when people just say "can't be done" - if there's a possible way to do it - explain it!

Give this a go:

Cut the code below, stick it in a page, and save it as "username.asp", not as "username.htm". And when you open the file, you HAVE to open it via "http://....", you can't just double-click on it in Windows Explorer (So the address can't be "C:/my documents/.....".
__________________________________________________________

<%@ LANGUAGE="VBSCRIPT" %>
<html>
<head>
<title>ASP User ID</title>
</head>
<body>
<%

'--- Get User LAN ID ---
Dim UserDomainLAN
    UserDomainLAN = UCase(Request.ServerVariables("LOGON_USER"))
If Len(UserDomainLAN) = 0 Then
    sValues = Request.ServerVariables("REMOTE_ADDR")
End If

%>
<%=UserDomainLAN%>
</body>
</html>
__________________________________________________________

Cheers
0
Radish21Author Commented:
So it actually has to be loaded from the web, not locally eh?  Well, may take me a while to organise that test... The plan was that I make the web locally, and when it's finished, then put it on the server...

Thanks again for the help, love coming across these friendly forums.

Yeah, I'm from Melbourne, but I'm stuck in Sydney at the moment ;)
I'm around the Dandenongs, yourself?
0
whammyCommented:
Cool, nice to see an Aussie on the forums. I hope to visit Australia one of these days.

Aussies are probably more like Americans (except that most Aussies I've met seem more fun loving and friendlier in general) than any other people I know of.

Besides, I love the desert - I plan on spending a good part of my time there if I ever get to go in the Outback. ;-)

Hope you get that WSH or ASP solution working, m8.
0
m8rixCommented:
Mate... I didn't realise there were so many fellow Aussies here...

I am also Aussie... I live in Melbourne too! I am from the Knox area (Sth/Est Suburbs)
0
Radish21Author Commented:
Yeah, I hope I get it working too ;)  Bloody web-master takes his time responding to my emails though, all I want is for him to create a directory for me, and give me permission!

Oh yeah, being laid back and having fun is the aussie motto (along with drinking beer and watching sport, but I think that's universal)!

What is it that you like about the desert?  Just a lot of red sand, with snakes everywhere....  Apart from the bloody great rock sticking out of the middle of our country....
But yes, I understand, it can be very beautiful out there.
I quite like the forests, a lot of that in Dandenongs (Victoria).

BTW, what do the Ops think of off-topic conversations?  I've been posting on the Java forums a lot, and every now and then a thread gets shut down.... A bit antisocial of them I think.
0
ijeCommented:
Looks like there's heaps of us!
I'm in Ascot Vale, but working in Sth Melb.

Wonder if there's any Indians here that wanna talk about cricket?
0
Radish21Author Commented:
>m8rix from Knox??  I'm from Upwey, right next to Belgrave!

What do you think of this new 0-zone?  Too many posh bars (bar bosh ;) and clothes shops.  A few cool stores inside though.  The Vmax is pretty cool too...
0
whammyCommented:
Not sure, but I had to say hi to a friendly Aussie (sorry if it's off topic!).

My Dad has some great war stories about Aussies he fought with in Vietnam. ;-)
0
Radish21Author Commented:
>m8rix from Knox??  I'm from Upwey, right next to Belgrave!

What do you think of this new 0-zone?  Too many posh bars (bar bosh ;) and clothes shops.  A few cool stores inside though.  The Vmax is pretty cool too...
0
Radish21Author Commented:
> Not sure, but I had to say hi to a friendly Aussie (sorry if it's off topic!).

I didn't mean OP as in me, but anyone who monitors these.  

I quite enjoy these off-topic conversations.  So, which country are you from whammy?
0
Radish21Author Commented:
> Not sure, but I had to say hi to a friendly Aussie (sorry if it's off topic!).

I didn't mean OP as in me, but anyone who monitors these.  

I quite enjoy these off-topic conversations.  So, which country are you from whammy?
0
whammyCommented:
The United States of America. ;-)

I don't know about everyone else, but I consider your country a great ally of ours, I like the people, and I think you've also fought alongside us in every war in recent (or not so recent) history - regardless of its popularity.

Not that that matters, but I just like the overall attitude of Aussies. If I was to live anywhere else in the world (and I may, someday) it would be in Australia.
0
Radish21Author Commented:
> Not sure, but I had to say hi to a friendly Aussie (sorry if it's off topic!).

I didn't mean OP as in me, but anyone who monitors these.  

I quite enjoy these off-topic conversations.  So, which country are you from whammy?
0
Radish21Author Commented:
> Not sure, but I had to say hi to a friendly Aussie (sorry if it's off topic!).

I didn't mean OP as in me, but anyone who monitors these.  

I quite enjoy these off-topic conversations.  So, which country are you from whammy?
0
whammyCommented:
Ahh!!! If you don't want to refresh the page, click the "reload this question" button. ;-)

It's a bug in EE, hopefully they will fix it long with all of the experts here. ;-)
0
whammyCommented:
I mean, click the link "Reload the question" at the upper left hand corner of the page.

And hopefully they will fix it "before" long. ;-)
0
Radish21Author Commented:
God almight, this post just keeps on appearing!!

Must be because I was clicking refresh to get the latest message....
Sorry all.

Is there another way of getting the latest messages, rather than having to open the notification email?  (I'm sure there would be, I'm asking what is it? ;)
0
m8rixCommented:
Yeah I've been to o-zone a few times.. I went to go to the Irish pub there in the first week and we ended up waiting in a que for an hour so we ended up going to the trusty Q-sportz...

Anyway I don't mind some of the new shops... Bar world is pretty nifty!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.