2012-09-22 278 views
1

我開發了新聞網站,我試圖從其他網站 閱讀RSS我用這個代碼讀取系統安全拋出:SecurityException

 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. 

任何機構可以說明問題了我,給了我一個解決方案

問候

+0

爲什麼要使用代理?嘗試沒有。 –

回答

0

您的用戶,帳戶或GoDaddy上的任何內容無權執行此操作。如果你應該有權限(不是每個人都有),請聯繫GoDaddy。

相關問題