Yup, I was trying the forms authentication but having some problems. So
before I work out those bugs, I thougt I would use the Windows
authentication to get the app up and running first.
Hello Flip,
> testing.Text = Thread.CurrentPrincipal.ToString();
This wont work because 1) You probably want Thread.CurrentPrincipal.Identity.Name
and 2) this would be the IPrincipal for the executing thread. In all likelihood,
this will be your ASPNET account.
> testing.Text = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();
This code is correct, but is still subject to item 2 from the previous item.
> testing.Text = User.ToString();
This is closest to my suggestion, however like in item 1, I believe you want
User.Identity.Name.
Also, I just realized my code should have been HttpContext.Current.User.Identity.Name.
Sorry for any confusion.
--
Matt Berther
http://www.mattberther.com
>> Given your examples below, I am assuming youre using Windows
>> Authentication.
[quoted text clipped - 10 lines]
>
> Thanks.
Flip - 26 Jan 2005 18:09 GMT
>> testing.Text =
>> System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();
> This code is correct, but is still subject to item 2 from the previous
> item.
If this is correct, can you see any reason why I would be getting a NPE for
the GetCurrent()? I think that's the null I'm seeing. :<
> This is closest to my suggestion, however like in item 1, I believe you
> want
I was just trying to find out what user/group is being used to execute the
script at runtime to find out the user/groups I need to give permission to
write to a file. That's what started this all off. Oddly I had to give
write access to Users, not the IUSR_machinename or the ASPNET account. :<
> Also, I just realized my code should have been
> HttpContext.Current.User.Identity.Name. Sorry for any confusion.
No probs, I haven't tried it yet, it'll be tonight. Thank you for the
clarification! :>