Hi,

On our intranet checkout page (used for telephone orders) we want to know
which person placed an order. Everybody is using Internet Explorer. We
have tried the following code to get the Windows username:

<script language="VBScript">

Set objWinShell = CreateObject("WScript.Shell")
document.checkout.added_by.value=
objWinShell.ExpandEnvironmentStrings("%USERNAME%")

</script>

But it doesn't seem to work, even when "Initialise and script ActiveX
controls not marked as safe" on the Local Intranet security settings is set
to Enable. We get "ActiveX component cannot create object: WScript.Shell"
errors. Windows Script Host is installed.

Does anyone have any ideas how we can implement this functionality? It
doesn't have to use WScript but it would be ideal if it could pick up on the
Windows username, instead of our users having to log in a second time.

Cheers,

Jamie.

Re: Getting username of intranet user by Ray

Ray
Thu Dec 04 09:14:01 CST 2003

This would be much better accomplished using server-side code. Since all of
your users are using IE, it will, by default, send the user's logon
credentials to an intranet site (a domain with no dots in the name,
http://yourintranet, for example) if the server requests logon credentials.
Turn off anonymous access for your site or the directory with this page and
enable integrated authentication in IIS. You can then get the username
with:

<% sUsername = Request.SErverVariables("AUTH_USER") %>

Ray at work


"James Brown" <james.brown@nospam.com> wrote in message
news:uPzqIhnuDHA.1760@TK2MSFTNGP10.phx.gbl...
> Hi,
>
> On our intranet checkout page (used for telephone orders) we want to know
> which person placed an order. Everybody is using Internet Explorer. We
> have tried the following code to get the Windows username:
>
> <script language="VBScript">
>
> Set objWinShell = CreateObject("WScript.Shell")
> document.checkout.added_by.value=
> objWinShell.ExpandEnvironmentStrings("%USERNAME%")
>
> </script>
>
> But it doesn't seem to work, even when "Initialise and script ActiveX
> controls not marked as safe" on the Local Intranet security settings is
set
> to Enable. We get "ActiveX component cannot create object: WScript.Shell"
> errors. Windows Script Host is installed.
>
> Does anyone have any ideas how we can implement this functionality? It
> doesn't have to use WScript but it would be ideal if it could pick up on
the
> Windows username, instead of our users having to log in a second time.
>
> Cheers,
>
> Jamie.
>
>



Re: Getting username of intranet user by James

James
Thu Dec 04 09:20:32 CST 2003

Ray,

Thanks for that - that's the way I would have done it originally.
Unfortunately we are not using IIS with ASP, we're using Apache with PHP.
If you have any idea how to do it that way then let me know! :-)

Other than that, the only way I can think of doing it is client sided...
Any other ideas?

Cheers,

Jamie.

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:eKvyAlnuDHA.2340@TK2MSFTNGP12.phx.gbl...
> This would be much better accomplished using server-side code. Since all
of
> your users are using IE, it will, by default, send the user's logon
> credentials to an intranet site (a domain with no dots in the name,
> http://yourintranet, for example) if the server requests logon
credentials.
> Turn off anonymous access for your site or the directory with this page
and
> enable integrated authentication in IIS. You can then get the username
> with:
>
> <% sUsername = Request.SErverVariables("AUTH_USER") %>
>
> Ray at work
>
>
> "James Brown" <james.brown@nospam.com> wrote in message
> news:uPzqIhnuDHA.1760@TK2MSFTNGP10.phx.gbl...
> > Hi,
> >
> > On our intranet checkout page (used for telephone orders) we want to
know
> > which person placed an order. Everybody is using Internet Explorer. We
> > have tried the following code to get the Windows username:
> >
> > <script language="VBScript">
> >
> > Set objWinShell = CreateObject("WScript.Shell")
> > document.checkout.added_by.value=
> > objWinShell.ExpandEnvironmentStrings("%USERNAME%")
> >
> > </script>
> >
> > But it doesn't seem to work, even when "Initialise and script ActiveX
> > controls not marked as safe" on the Local Intranet security settings is
> set
> > to Enable. We get "ActiveX component cannot create object:
WScript.Shell"
> > errors. Windows Script Host is installed.
> >
> > Does anyone have any ideas how we can implement this functionality? It
> > doesn't have to use WScript but it would be ideal if it could pick up on
> the
> > Windows username, instead of our users having to log in a second time.
> >
> > Cheers,
> >
> > Jamie.
> >
> >
>
>



Re: Getting username of intranet user by Ray

Ray
Thu Dec 04 09:36:40 CST 2003


"James Brown" <james.brown@nospam.com> wrote in message
news:OAvXqonuDHA.620@TK2MSFTNGP10.phx.gbl...
> Ray,
>
> Thanks for that - that's the way I would have done it originally.
> Unfortunately we are not using IIS with ASP, we're using Apache with PHP.
> If you have any idea how to do it that way then let me know! :-)

Eegs!

>
> Other than that, the only way I can think of doing it is client sided...
> Any other ideas?

Okay, try this client side code then with "Initialize and script ActiveX
controls not marked as safe" enabled. (Be careful of your zones here...
You'll only want to do this in intranet or trusted, preferable trusted, and
you control trusted).


<script language="vbscript">
document.checkout.added_by.value=createObject("WScript.Network").Username
</script>

Ray at work





Re: Getting username of intranet user by Joe

Joe
Thu Dec 04 10:55:51 CST 2003

Works for me with those settings although I usually use the wscript.network
object and the username property.

Joe

"James Brown" <james.brown@nospam.com> wrote in message
news:uPzqIhnuDHA.1760@TK2MSFTNGP10.phx.gbl...
> Hi,
>
> On our intranet checkout page (used for telephone orders) we want to know
> which person placed an order. Everybody is using Internet Explorer. We
> have tried the following code to get the Windows username:
>
> <script language="VBScript">
>
> Set objWinShell = CreateObject("WScript.Shell")
> document.checkout.added_by.value=
> objWinShell.ExpandEnvironmentStrings("%USERNAME%")
>
> </script>
>
> But it doesn't seem to work, even when "Initialise and script ActiveX
> controls not marked as safe" on the Local Intranet security settings is
set
> to Enable. We get "ActiveX component cannot create object: WScript.Shell"
> errors. Windows Script Host is installed.
>
> Does anyone have any ideas how we can implement this functionality? It
> doesn't have to use WScript but it would be ideal if it could pick up on
the
> Windows username, instead of our users having to log in a second time.
>
> Cheers,
>
> Jamie.
>
>



Re: Getting username of intranet user by James

James
Fri Dec 05 04:35:44 CST 2003

Hi,

Thanks you both for your advice - I've changed over to the Username property
on the Network object and it works fine.

Jamie.

"James Brown" <james.brown@nospam.com> wrote in message
news:uPzqIhnuDHA.1760@TK2MSFTNGP10.phx.gbl...
> Hi,
>
> On our intranet checkout page (used for telephone orders) we want to know
> which person placed an order. Everybody is using Internet Explorer. We
> have tried the following code to get the Windows username:
>
> <script language="VBScript">
>
> Set objWinShell = CreateObject("WScript.Shell")
> document.checkout.added_by.value=
> objWinShell.ExpandEnvironmentStrings("%USERNAME%")
>
> </script>
>
> But it doesn't seem to work, even when "Initialise and script ActiveX
> controls not marked as safe" on the Local Intranet security settings is
set
> to Enable. We get "ActiveX component cannot create object: WScript.Shell"
> errors. Windows Script Host is installed.
>
> Does anyone have any ideas how we can implement this functionality? It
> doesn't have to use WScript but it would be ideal if it could pick up on
the
> Windows username, instead of our users having to log in a second time.
>
> Cheers,
>
> Jamie.
>
>