Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / General CF Topics / September 2008



Tip: Looking for answers? Try searching our database.

Nt username

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
emmim44 - 28 Aug 2008 16:12 GMT
How to get nt username using CF? Please anyone, thanks....
Dan Bracuk - 28 Aug 2008 16:15 GMT
cfldap
Ian Skinner - 28 Aug 2008 16:36 GMT
> cfldap

OR cgi.auth_user if windows integrated security is turned on in IIS

I've also done things with <cfexecute...> to run dos commands such as
netstat.
emmim44 - 28 Aug 2008 19:09 GMT
Do you have an example?
Ian Skinner - 28 Aug 2008 19:14 GMT
> Do you have an example?

<cfexecute name="C:\WINDOWS\system32\net.exe" arguments="name"
variable="remoteData" timeout="5"/>

You then parse the 'remoteData' variable string which is the output from
the DOS command for the desired information.

This assumes you can run some DOS command that would provide useful
information.
emmim44 - 28 Aug 2008 16:50 GMT
I meant I am tyring to get the username that I login in to my local machine which is novel username...
BKBK - 28 Aug 2008 19:29 GMT
http://livedocs.macromedia.com/coldfusion/7/htmldocs/00000301.htm
emmim44 - 28 Aug 2008 19:40 GMT
I am trying to execute this '<cfexecute name="u" arguments="echo %username%
"></cfexecute>
<cfoutput>#u#</cfoutput><cfabort>'

but error...
An exception occurred when invoking an external process.  
The cause of this exception was that: java.io.IOException: CreateProcess: u
echo %username% error=2.
Ian Skinner - 28 Aug 2008 20:10 GMT
> I am trying to execute this '<cfexecute name="u" arguments="echo %username%"></cfexecute>

ColdFusion does not have a PATH environment variable that allows it to
just give the command.  You have to provide the fully qualified path to
the 'echo' executable.
emmim44 - 28 Aug 2008 22:20 GMT
And that path would be ???
Ian Skinner - 28 Aug 2008 22:55 GMT
> And that path would be ???

Whatever executable you are trying to run on your server.
BKBK - 29 Aug 2008 05:27 GMT
[i]How to get nt username using CF? [/i]

http://livedocs.macromedia.com/coldfusion/7/htmldocs/00000301.htm, then cfntauthenticate.username or result.username
emmim44 - 29 Aug 2008 14:14 GMT
That requires an username and password, and I am looking to retrieve the nt username of a client whoever runs my page....
BKBK - 30 Aug 2008 07:58 GMT
I see now that you want Coldfusion to give you a Windows username. My
suggestion is indeed of little use to you. Coldfusion is only aware of
usernames that were logged in within a Coldfusion context.

You should do it in a Windows context. Ian Skinner's cfexecute suggestion
would then be, in my opinion, the best method.
emmim44 - 02 Sep 2008 16:50 GMT
It is not a good help so far...
Azadi - 02 Sep 2008 16:53 GMT
try harder.

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
tclaremont - 02 Sep 2008 17:11 GMT
If the suggestions provided so far are not working for you, then I suspect that the problem is between the keyboard and the chair.
emmim44 - 02 Sep 2008 20:07 GMT
<cfexecute name="u" arguments="C:/cmd echo %username%"></cfexecute>

I dont think that will work... One thing I am afraid is it might not give the username of the client who execute my page...
Ian Skinner - 02 Sep 2008 21:08 GMT
> <cfexecute name="u" arguments="C:/cmd echo %username%"></cfexecute>

No, I suspect that will give the user name ColdFusion is running under,
if anything at all.

Is this over a well defined intranet or are you trying something over
the entire world wide web internet?

On a well defined intranet where the systems can see each other there is
some type of net state utility that can give some details from a
computer with the IP address, which can be found in the CGI scope.  At
least there is on a Windows machine and network.

I know I once used this to have a intranet web page show the machine
name of a logged in user to aid our help desk.  The ColdFusion code used
<cfexecute...> to run a DOS command that retrieved the machine name
across the corporate's Windows network.  They could ask Mary Jane Von
Der Longname to look in the corner of the intranet home page to find out
their machine name easily and quickly.

Since otherwise only 1% of the users would know this without detailed,
step-by-step, walk-through instructions.  And many of the remaining 99%
would still fail even with such instructions.
emmim44 - 02 Sep 2008 22:17 GMT
It is a intranet environment... not external web...
tclaremont - 03 Sep 2008 14:33 GMT
As has been mentioned before in this thread....

IF you are using Internet Information Services and you have Integrated
Authentication turned on (a checkbox within IIS), you can use the cgi variable
#CGI.AUTH_USER#.

This will return the doman name and username of the person logged into the
computer visiting your site. If you are unsure of your envrionment, go ahead
and put #CGI.AUTH_USER# on a blank page and run the page. What do you get? When
YOU view the page on your intranet it should return your domain/username.

Using simple string functions you can trim the domain name, since you KNOW
what the domain name will be. In my case I use the following, since I know my
domain and the slash are ten characters long: <CFSET VisitorName =
#lcase(removeChars(cgi.auth_user, 1, 10))#>

With this information, I can do a quick lookup in my user database to
determine the permissions for the user in question, using the variable I set
above as #VisitorName#.

If the user tries to access a section of the site that they do NOT have
permissions for, or in the bizzare case where the username is undefined, I use
CFLOCATION to transport them to an Access Request Page. They fill out the
request form, and ColdFusion emails it to me. I change the requestors
permissions in the database and they are then allowed to view the originally
requested page.
Ian Skinner - 03 Sep 2008 14:42 GMT
> In my case I use the following, since I know my
> domain and the slash are ten characters long: <CFSET VisitorName =
> #lcase(removeChars(cgi.auth_user, 1, 10))#>

A slightly easier way to do this, that does not require one 'knowing'
one's domain.  Even though that should be well known.

<cfset userName = listLast(cgi.auth_user,"\")>
<cfset domain = listFirst(cgi.auth_user,"\")>
emmim44 - 03 Sep 2008 14:53 GMT
The output from #CGI.AUTH_USER#  after turning on the 'Integrated Authentication'  is nada... I am running my local CF server as built in...
How would I do that?
Ian Skinner - 03 Sep 2008 14:58 GMT
> The output from #CGI.AUTH_USER#  after turning on the 'Integrated Authentication'  is nada... I am running my local CF server as built in...
> How would I do that?

Well the built in CF web server is not 'Windows' so it does not play
with 'Windows Integrated Authentication', but then you shouldn't have
the IIS management console where one would "turn on 'Integrated
Authentication'", if you are not using IIS as your web server.

So can you explain your server configuration here?  What is your web
server?  Where is your ColdFusion server?  How have they been tied together?
emmim44 - 03 Sep 2008 15:06 GMT
I execute a CF page using http://localhost:8500 since it is built in server... My IIS is set up. My environment is intranet...I am using my local machine as cf server...etc
Ian Skinner - 03 Sep 2008 15:17 GMT
I execute a CF page using http://localhost:8500 since it is built in
server...
My IIS is set up.
My environment is intranet...
I am using my local machine as cf server...
etc

Well if you have CF's built in server and IIS set up then you have two
web servers running.  One on port 8500 serving ColdFusion pages and
another, probably on port 80, that knows who you are because of it's
'Windows Integrated' security feature.

Obviously you need to get this consolidated into one web server that
both runs ColdFusion and knows how to use Windows Integrated security to
inform you of who is using your CF applications.

In other words you need to reconfigure your ColdFusion application
server to utilize your IIS web server.  Unfortunately I cannot advice
you on how this is done after ColdFusion has been installed.  I have
*always* configured my CF to use IIS when I install it.

All of this is on your local machine correct?
Azadi - 03 Sep 2008 15:28 GMT
just run wsconfig.exe located in {cf_install_dir}/runtime/bin, or,
easier, you should have a Web Server Configuration Tool item in your
Start > All Programs > Adobe > Coldfusion 8 [or Start > All Programs >
Macromedia > Coldfusion MX 7]

it should automatically see your IS server an let you configure it. just
select "All IIS Websites" option and click OK.

You will then have to go into IIS Management Console and delete
iisstart.aps in Default Document tab, otherwise your server will keep
prompting you for a username and password.

NOTE: this all is from memory, which has been hampered by a couple of
Weihenstephan Heffe Weissbier glasses...

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Azadi - 03 Sep 2008 15:31 GMT
you might think that weissbier has hampered with my typing, too... but i
prefer to blame it on the lame keyboard on this acer lap...

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Ian Skinner - 03 Sep 2008 15:52 GMT
> just run wsconfig.exe

And there would be no problem having two web serves running both serving
up ColdFusion pages?

I would presume not if the two web servers are running on different
ports, but I have to say I have never tried this.  Or even conceived it
before now.

Following this line of thought, it should be possible to have
ColdFusion's built in web server, IIS and Apache all serving up
ColdFusion applications on the same Windows OS as long as each web
server has it's own port, correct.

I'm not sure why one would really want all that, but I'm almost geeky
enough just to try it someday if I ever have some spare time.
emmim44 - 03 Sep 2008 18:26 GMT
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.