系统安全SecurityException

时间:2012-09-22 17:09:43

标签: c# rss xmlreader

我开发了新闻网站,并试图从其他网站读取rss 我用这段代码来阅读

      private void GetRSS()
          {
    try
    {
        WebRequest rssReq =ebRequest.Create("http://www.aljazeera.net/AljazeeraRss/845674de-               

       e247-4149-b2c4-432d70b0076b/acefc2c1-1a68-4977-91c3-969026916497");

        //Create a Proxy
        WebProxy px = new WebProxy("http://www.aljazeera.net/AljazeeraRss/845674de-e247-         

        4149-b2c4-432d70b0076b/acefc2c1-1a68-4977-91c3-969026916497", true);
        //   XPath="/rss/channel/item";
        //Assign the proxy to the WebRequest
        rssReq.Proxy = px;

        //Set the timeout in Seconds for the WebRequest
        rssReq.Timeout = 5000;
        try
        {
            //Get the WebResponse
            WebResponse rep = rssReq.GetResponse();

            //Read the Response in a XMLTextReader
            XmlTextReader xtr = new XmlTextReader(rep.GetResponseStream());

            //Create a new DataSet
            DataSet ds = new DataSet();
            //Read the Response into the DataSet
            ds.ReadXml(xtr);
            //Bind the Results to the Repeater
            Repeater1.DataSource = ds.Tables[3]; ;
            Repeater1.DataBind();
        }
        catch(Exception EX)
        {
            throw EX;
        }
        //ProcessRSSItem("http://www.bbc.co.uk/arabic/index.xml");

    }
    catch (Exception EX)
    {
        throw EX;
    }
}

它在本地主机上的工作非常好但是当我在我的godaddy帐户上传它时它没有读任何东西而且我有这个错误

Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

任何人都可以为我描述问题并给我一个解决方案

问候

1 个答案:

答案 0 :(得分:0)

GoDaddy上的您的用户,帐户或其他任何人都无权执行此操作。如果您应该拥有权限(并非所有人都拥有权限),请与GoDaddy联系。