本文介绍了系统安全性SecurityException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好
我开发了新闻网站,并试图从另一个网站阅读rss
我用这段代码阅读

hello
i developed news site and am trying to read rss from another site
i used this code to read

private void GetRSS()
 {
     try
     {
         WebRequest rssReq = WebRequest.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帐户时,它没有读取任何内容,并且出现此错误

异常详细信息:System.Security.SecurityException:请求类型为"System.Net.WebPermission,系统,版本= 2.0.0.0,区域性=中性,PublicKeyToken = b77a5c561934e089"的权限失败.
任何人都可以为我描述问题并给我解决方案


问候


its working very nice on local host but when i upload it on my godaddy account it doesn''t read any thing and i have this error

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.
can any body describe the problem for me and gave me a solution


regards

推荐答案



这篇关于系统安全性SecurityException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 20:22