473,385 Members | 2,044 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Creating web service connector automation

I have written an automation class that connects to an URL, and downloads the content into an ordinary string variable.

But when I run my method I get an error saying:
Request for the permission of type System.Web.Permission, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.

My method looks like this:
WebClient webClient = new WebClient();
new WebPermission(NetworkAccess.Accept|NetworkAccess.C onnect, "*").Assert();
StreamReader streamReader = new StreamReader(webClient.OpenRead(urlString));
String content = streamReader.ReadToEnd();

Does anyone know whats wrong??

--------------------------------
From: H?kan Bengtsson

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>SjikVFVqq02kScaGXbo93g==</Id>
Nov 16 '05 #1
1 1696

"H?kan Bengtsson via .NET 247" <an*******@dotnet247.com> schrieb im
Newsbeitrag news:u%***************@TK2MSFTNGP15.phx.gbl...
I have written an automation class that connects to an URL, and downloads the content into an ordinary string variable.
But when I run my method I get an error saying:
Request for the permission of type System.Web.Permission, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
My method looks like this:
WebClient webClient = new WebClient();
new WebPermission(NetworkAccess.Accept|NetworkAccess.C onnect, "*").Assert();

http://msdn.microsoft.com/library/de...classtopic.asp

"WebPermission provides a set of methods and properties to control access to
Internet resources. You can use a WebPermission to provide either restricted
or unrestricted access to your resource, based on the PermissionState set
when the WebPermission is created."

I think your problem is more of Credentials, try to add:
webClient.Credentials=System.Net.CredentialCache.D efaultCredentials;

StreamReader streamReader = new StreamReader(webClient.OpenRead(urlString)); String content = streamReader.ReadToEnd();

Does anyone know whats wrong??

--------------------------------
From: H?kan Bengtsson

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>SjikVFVqq02kScaGXbo93g==</Id>

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ruud vd Velden | last post by:
Hello, We're using Office XP on Windows 2000 SP4. After installing the Oracle Connector for Outlook the following problem occurs: Emails sent by Outlook, in HTML format, do have a strange...
5
by: Guy Incognito | last post by:
Hello, I've written an asp.net application that creates Excel documents. It works by creating an excel document in XML format. But I wonder if I'm reinventing the wheel. I know that there are...
0
by: EagleRed | last post by:
I have written a Web service that I must access from a modified VC++ 6.0 console application. I am using the SOAP Toolkit version 2.0. I am using the HttpConnector, and the SoapSerializer to...
0
by: DWillems | last post by:
Hello, I have developped a C# XML Web Service. Methods of this Web Service will be accessed by a SAP Business Connector via XML. This all architecture will have to run for several countries...
10
by: Clint | last post by:
Hey all - I'm having a really confusing problem concerning a web service. Right now, I have an application that needs to call a web service that does nothing but return "true" (this will...
2
by: Reshma Prabhu | last post by:
Hello, I have created an web service in C# and accessing it thrugh C++ code. But when i make a call through the client, the parameter does not reach the server but it does not show any error...
0
by: naveed | last post by:
Hi, I have a scenario where i need to extract a Excel sheet data from my web service. How i can do that from my web serivce. Is it possible to use OLE Automation from my web service and then the...
9
by: Tony Proctor | last post by:
I need to create a process Singleton object for an ASP application, but I'm having some odd issues In my GLOBAL.ASA, I have an <OBJECTelement specifying the relevant ProgID with RUNAT=Server and...
1
by: Manjunath.M | last post by:
Hi, I have created a simple Web service with only one function, which takes only one parameter. Below is the function from Web service public string HelloWorld(string input) { return "Hello...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.