470,586 Members | 1,610 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,586 developers. It's quick & easy.

SQL 2005 Assembly: System.Security.SecurityException: Request for the permission of type 'System.Net.WebPermission'... failed

I'm trying to fetch an XML document from a website through an assembly
i built and attached to SQL 2005.
Here is my code for the SPROC assembly:

[Microsoft.SqlServer.Server.SqlProcedure]
public static void fetch_FeedData(string m_URL)
{
SqlPipe p = SqlContext.Pipe;

XmlDocument xmlRSS = new XmlDocument();

xmlRSS.Load(m_URL);

p.Send(xmlRSS.OuterXml);
}

Here's the exception:

A .NET Framework error occurred during execution of user defined
routine or aggregate 'fetch_FeedData':
System.Security.SecurityException: Request for the permission of type
'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' failed.
System.Security.SecurityException:
at System.Security.CodeAccessSecurityEngine.Check(Obj ect demand,
StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.CodeAccessPermission.Demand()
at System.Net.HttpWebRequest..ctor(Uri uri, ServicePoint
servicePoint)
at System.Net.HttpRequestCreator.Create(Uri Uri)
at System.Net.WebRequest.Create(Uri requestUri, Boolean useUriBase)
at System.Net.WebRequest.Create(Uri requestUri)
at System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri,
ICredentials credentials)
at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials
credentials)
at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role,
Type ofObjectToReturn)
at System.Xml.XmlTextReaderImpl.OpenUrlDelegate(Objec t xmlResolver)
at System.Threading.CompressedStack.runTryCode(Object userData)
at
System.Runtime.CompilerServices.RuntimeHelpers.Exe cuteCodeWithGuaranteedCleanup(TryCode
code, CleanupCode backoutCode, Object userData)
at System.Threading.CompressedStack.Run(CompressedSta ck
compressedStack, ContextCallback callback, Object state)
at System.Xml.XmlTextReaderImpl.OpenUrl()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader,
Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.Load(String filename)
at StoredProcedures.fetch_FeedData(String m_URL)
..

Thansk for the help in advance!

Oct 5 '06 #1
0 1963

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by James B | last post: by
3 posts views Thread by Daylor | last post: by
1 post views Thread by Adrian | last post: by
1 post views Thread by bilal.hamdan | last post: by
5 posts views Thread by Henry Stock | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.