|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
hi, i cannot quite figure this one out. i have a small java program that returns a user's windows login. i use the following code to get the result out of that java program.
<cfobject action="create" type="java" class="GetUser1" name="emp"> <cfset emp.init()> <cfset user = emp.gUser()> <cfoutput>#user#</cfoutput> and here is the small java program called GetUser1.java public class GetUser1 { public String uName; public String gUser() { uName = System.getProperty("user.name"); return uName; } } When i run the CF code on the server, it displays 'SYSTEM' instead of my windows user name. does anyone know why it displays 'SYSTEM'? |
|
#2
|
||||
|
||||
|
What happens when you run the code through JVM and not just through CF?
|
|
#3
|
|||
|
|||
|
since there is no main method it won't run thru JVM. but that is not the problem, i can modify it to display something else such as
uName = "crap"; and it will write crap on the screen. eventually, the application will have to run on the client side to get the client's username. then, i take that username and use CF to insert into a DB table on the server side. it kind of sounds like hacking. i am not sure if this will work out, but if anyone has any idea please shoot... thanks |
|
#4
|
|||
|
|||
|
hai FalconsEye,
I think this is a real bug in CFML.I am also working on similar cfml application. I tested your code differently, <cfset myobject = createobject("java","getuser1")> <cfset user = myobject.gUser()> <cfoutput>#user#</cfoutput> but still "SYSTEM" is the output.... If you execute the same code in java we are getting the correct answer, class getuser { public String uName; public String gUser() { uName = System.getProperty("user.name"); return uName; } } public class getuser1 { public static void main(String args[]) { getuser g = new getuser(); String p = g.gUser(); System.out.println(p); } } output: C:\jdk1.3\bin>javac getuser1.java C:\jdk1.3\bin>java getuser1 administrator C:\jdk1.3\bin> So, i think it is a real problem in CFML which should be corrected. If any body has valuable suggestions ,please suggest.. bye Kishore prs |
|
#5
|
|||
|
|||
|
This isn't a bug at all; it's doing exactly what it is supposed to do. The user account that is executing the code is the user account that *ColdFusion* is running under. Obviously the CF service is using the SYSTEM account so that is what you see.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
|
#6
|
|||
|
|||
|
hai kiteless,
Its a great work. I agree with you. So, can you tell us how we can get the exact result(user account) but not the cold fusion account. thank you, with regards, Kishore PRS |
|
#7
|
|||
|
|||
|
Not that I know of, except to have a login system, or to inspect the cgi scope if the user has logged into a site using OS level security. I believe there is a variable called auth_user once the user has logged into the site, but again this is only if you are using OS/Web server permissions on the directories of your web site.
But no, as far as I know there is no way for the CF server (or any other application server for that matter) to know anything about which user account the user is using on their local machine. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Java and CF |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|