P
Philip Colmer
I've written a web service that returns some user-specific information. I'm
calling that web service from an InfoPath form as managed code:
MsgBox("Calling WhoAmI service", MsgBoxStyle.OKOnly, "OnLoad")
Try
svc.Credentials =
System.Net.CredentialCache.DefaultCredentials()
MsgBox("Set service credentials", MsgBoxStyle.OKOnly,
"OnLoad")
Try
_Initials = svc.GetInitials("")
MsgBox("Got '" & _Initials & "'", MsgBoxStyle.OKOnly,
"OnLoad")
Catch ex As Exception
MsgBox("Failed to get initials: " & ex.ToString,
MsgBoxStyle.OKOnly, "OnLoad")
End Try
Catch ex As Exception
MsgBox("Failed to set credentials: " & ex.ToString,
MsgBoxStyle.OKOnly, "OnLoad")
End Try
svc.Dispose()
MsgBox("Disposed of service object", MsgBoxStyle.OKOnly,
"OnLoad")
If I've got the form on my computer, it works fine - it sets the
credentials, gets my initials back from the web service & disposes of the
object. If, however, I publish the form to a SharePoint forms library and
open the form from there, the call to svc.Credentials fails with:
System.Security.SecurityException: Request for the permission of type
System.Security.Permissions. EnvironmentPermission, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
The web service is configured to use integrated windows authentication.
Can anyone tell me how to resolve this, please?
--Philip
calling that web service from an InfoPath form as managed code:
MsgBox("Calling WhoAmI service", MsgBoxStyle.OKOnly, "OnLoad")
Try
svc.Credentials =
System.Net.CredentialCache.DefaultCredentials()
MsgBox("Set service credentials", MsgBoxStyle.OKOnly,
"OnLoad")
Try
_Initials = svc.GetInitials("")
MsgBox("Got '" & _Initials & "'", MsgBoxStyle.OKOnly,
"OnLoad")
Catch ex As Exception
MsgBox("Failed to get initials: " & ex.ToString,
MsgBoxStyle.OKOnly, "OnLoad")
End Try
Catch ex As Exception
MsgBox("Failed to set credentials: " & ex.ToString,
MsgBoxStyle.OKOnly, "OnLoad")
End Try
svc.Dispose()
MsgBox("Disposed of service object", MsgBoxStyle.OKOnly,
"OnLoad")
If I've got the form on my computer, it works fine - it sets the
credentials, gets my initials back from the web service & disposes of the
object. If, however, I publish the form to a SharePoint forms library and
open the form from there, the call to svc.Credentials fails with:
System.Security.SecurityException: Request for the permission of type
System.Security.Permissions. EnvironmentPermission, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
The web service is configured to use integrated windows authentication.
Can anyone tell me how to resolve this, please?
--Philip