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

Discussion in 'ASP .Net' started by Siberwulf, Oct 6, 2006.

  1. Siberwulf

    Siberwulf Guest

    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(Object 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(Object xmlResolver)
    at System.Threading.CompressedStack.runTryCode(Object userData)
    at
    System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode
    code, CleanupCode backoutCode, Object userData)
    at System.Threading.CompressedStack.Run(CompressedStack
    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!
     
    Siberwulf, Oct 6, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. stephen
    Replies:
    4
    Views:
    4,299
    Nicole Calinoiu
    Aug 9, 2006
  2. John G
    Replies:
    1
    Views:
    838
    Dominick Baier
    Nov 28, 2007
  3. Henry Stock

    System.Security.SecurityException: Request

    Henry Stock, Aug 16, 2008, in forum: ASP .Net
    Replies:
    5
    Views:
    710
    Henry Stock
    Aug 17, 2008
  4. Sunetra Urhekar

    System.Security.SecurityException: Request failed

    Sunetra Urhekar, Nov 8, 2004, in forum: ASP .Net Security
    Replies:
    0
    Views:
    120
    Sunetra Urhekar
    Nov 8, 2004
  5. Leyla
    Replies:
    2
    Views:
    688
    Leyla
    Aug 17, 2006
Loading...

Share This Page