Solved

Using Javascript and .htaccess

Posted on 1997-08-12
4
284 Views
Last Modified: 2008-03-10
Is there a way using JavaScript to get the username of someone who logs into a page protected by a htaccess file?  I would just use CGI for this (the REMOTE_USER environment variable), but for some strange reason my server isn't configured to use htaccess under the cgi-bin directory.
0
Comment
Question by:jgottden
4 Comments
 

Expert Comment

by:srudy
ID: 1268938
The only way to get this information, due to javascript's limited security is to call an external program.  I would say you should try to figure out why you can't access the REMOTE_USER variable and go from there.

If you are using Netscape Enterprise server and LiveWire there is a way to call an external C library and access the REMOTE_USER variable as well.  I have the code for that method.  However it sounds like you know how you are going to get the information from using CGI scripting, so you should proably just stick to that solution.

Good luck...

Scott Rudy
0
 
LVL 1

Expert Comment

by:909233
ID: 1268939
In Javascript you may not necessarily get the username but you
most certainly can obtain the user's browser/ip address
0
 
LVL 5

Expert Comment

by:Christian_Wenz
ID: 1268940
i don't know why you rejected srudys' answer - it was obviously correct!
0
 
LVL 1

Accepted Solution

by:
gabsi earned 50 total points
ID: 1268941
U have to use a protected CGI ie: a CGI which needs authentification to be accessed.
Than the REMOTE_USER variable can be used.
Note that REMOTE_USER variable does not mean the useridentification on his own machine. Only AS WHO is he known for your CGI.The value of this variable is file/directory dependant:
A same user may have 2 differents REMOTE_USER values for 2 cgi which have different access rules.
I dont see how does your server refuse to protect some directories you want to (cgi or others).
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
maps stopped work unsure why 7 36
javascript comparing two dates 3 19
Jquery 2 13
Create an automated page index 9 19
I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question