Jump to content

%username% in URL possible?


Recommended Posts

Folks, I am interested in passing an environment variable in a URL. The goal is to automatically log the user in based on who they are logged onto the workstation as without any prompts.

The url will be http://helpdeskserver/caisd/pdmweb.exe?USERNAME=%username%

The web site is developed on IIS with Frontpage. Frontpage doesn't interpret the %username% correctly and passes an argument error.

Can anyone assist?

J (flynnj@sddc.army.mil)

Link to comment
Share on other sites


  • 1 month later...

You might be able to get away with having the page just ask for their name, perhaps with a password like most do. If not, I'd write a small program which opens the page. GetUserName() will tell you the name, and I think you can use ShellExecute() to open the URL. (I did it once, but I don't recall how and don't feel like checking right now. Pretty sure that was it though. It opens in the user's default browser too.)

If you need to keep track of the name on multiple pages, store it in a cookie or database with an expiration date and have a 'log out' link to clear it. If no name is logged, tell the user to run the program again, and offer a link to it.

There might also be some ActiveX solution, but now you're getting into nasty IE-only stuff.

Link to comment
Share on other sites

JavaScript has no way to grab the local users username. But in an Intranet solution with an Active Directory server, you can get the username via ASP and ASP.Net programming, here are my notes on the subject

=================================================

Retrieving the web user's username in a Domain/Intranet for ASP.Net

=================================================

Manage IIS > right Click Web Sites > Properties > Directory Security >

Edit Button (Auth & Access Control) > uncheck 'Enable anonymous access'

and make sure 'Integrated Widows Auth' is check marked

Then if you want the ASP.Net to run as the web user then add this to

your web.config

<identity impersonate="true" />

Now you can access the username by:

HttpContext.Current.User.Identity.Name;

using System.Security.Principal;

System.Threading.Thread.CurrentPrincipal.Identity.Name;

or in classic ASP:

Request.ServerVariables("LOGON_USER")

-----------------------

If your app is not ASP or ASP.Net you're probably screwed but I haven't used PHP, Cold Fusion or Perl for years and perhaps there is a way now.

Edited by Rhelic
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...