Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Logged in windows username using ActiveXObject

 
bikkie bansal
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I trying to get logged in windows username using javascript.
I found this piece of code from some forum.



This code is working fine when I run from my local directory. But when I deploy it in IIS server I am getting error message "Automation server can't create object".
Do I have to do some setting in IIS server?

Thanks in advance.
Bikkie
 
Nikhil Padharia
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try using this code, I am not sure if it will work in all scenarios, as I too found it from some forum ;)


 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Automation server can't create object" is the error thrown when Active X Security settings are turned on high and prevent certain things from running. Your local site is under intranet or trusted settings which has different security settings.

There is no way in JavaScript to change the setting, user has to do it manually either changing it for the zone OR adding your site to trusted domains list.

Eric
 
bikkie bansal
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Eric,

Thanks for your reply. When I changed my local intranet setting from "medium high" to "low" its working fine.
But we cant force client to change their local intranet setting so is there any other way to get username. By doing some googling I found we can use applets or signed jars. I tried applets also but when I used applet I got security permission exception.

Please suggest any solution using which I can get username in my HTML page.

Thanks,
Bikkie
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is nothing to do but change settings and by using activeX, you are locking yourself into an IE only solution which is horrible. Coding like that is why companies are still stuck on IE6.

If this app is to be run on an intranet, there are ways you can get the login there. If it is a we app, you are out of luck.
 
bikkie bansal
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Eric,

This application will be used within intranet only for limited number of users.

Please suggest solution to get username. I am using HTML for UI, IIS 7.5 web server and WCF RESTful web services at backend.

Thanks,
Bikkie
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using LDAP?
 
bikkie bansal
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Eric,

I tell you my use case.
User will login into his/her desktop/system though his/her windows credentials which will get validate against LDAP.
Once user successfully logged-in and try to access our application, HTML page should read his/her windows username from NTLM and pass it to authorization service of our application.
If user is successfully logged-in then he/she should not prompt for login again only he/she should be check for authorization only.

This is the our use case.
So i need only logged in person's username.

Thanks,
Bikkie
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic