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.
任何机构可以说明问题了我,给了我一个解决方案
问候
为什么要使用代理?尝试没有。 –