Environment.Username

S

smiling1

I have Visual Basic code in an InfoPath form that uses
Environment.Username to retrieve the user's ID. The code works fine
for me and another person in our office.

Other users, however, get the error below. I've looked at IE security
settings, haven't seen any differences (could be missing something).
Where should I look?

Ideas?

thanks!



Request for the permission of type
System.Security.Permissions.EnvironmentPermission, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
failed.

at
System.Security.CodeAccessSecurityEngine.CheckHelper(PermissionSet
grantedSet, PermissionSet deniedSet, CodeAccessPermission demand,
PermissionToken permToken)

at System.Security.CodeAccessSecurityEngine.Check(PermissionToken
permToken, CodeAccessPermission demand, StackCrawlMark& stackMark,
Int32 checkFrames, Int32 unrestrictedOverride)

at
System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission
cap, StackCrawlMark& stackMark)

at System.Security.CodeAccessPermission.Demand()

at System.Environment.get_UserName()

at
InfoPathProject2.InfoPathProject2.btnApplicationManager_OnClick(DocActionEvent
e) in C:\my_data\Visual Studio
Projects\InfoPathProject2\FormCode.vb:line 351

at
Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent
pEvent)
 
B

Ben Walters

Hey Smiling1
Although I can't explain why this works for some people and not others, have
you tried increasing the forms security level to full trust?
Cheers
Ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top