Unable to resolve user environment variable correctly
- by Junaid
I am trying to resolve %USERPROFILE% using WScript.Shell. When I create a vbs file and run directly from Windows, I get the correct path for the logged-in user C:\Documents and Settings\Administrator but it gets resolved to C:\Documents and Settings\Default User instead of logged-in user when I used it inside my classic ASP webapp running on the local machine on IIS.
The code I used is as below
var oShell = new ActiveXObject("Wscript.Shell");
var userPath = oShell.ExpandEnvironmentStrings("%USERPROFILE%");
Is there a permission/setting which I need to check to get correct value of USERPROFILE when retrieving value from the webapp?
PS: I am using javascript to code.