AspNetHostingPermission Error

B

Brian

I would like to submit xml docs to a web service using
Infopath. However we have proxy servers in front which
need to be logged into first, therefore I need to run some
custom code before I submit. I created a custom task pane
with the corresponding text boxes and submit button which
calls a method in FormCode.cs. I can call the method from
FromCode.cs with out a problem until I try to instantiate
a class. I get the following error if I use the following
code in the method:
Code:
ASCIIEncoding encoding = new ASCIIEncoding();
string postData = "username=" + username + "&password=" +
HttpUtility.UrlEncode(password,Encoding.ASCII);
byte[] byte1 = encoding.GetBytes(postData);

Error:
System.Security.SecurityException
Request for the permission of type
System.Web.AspNetHostingPermission, System,
Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089 failed.

Is there any way around this security problem? Do I need
to install a certificate on my form?

Thanks
Brian
 

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