Click here to Skip to main content
13,293,126 members (97,211 online)
Rate this:
Please Sign up or sign in to vote.
See more:
i developed news site and am trying to read rss from another site
i used this code to read
   private void GetRSS()
            WebRequest rssReq = WebRequest.Create("");
            //Create a Proxy
            WebProxy px = new WebProxy("", 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;
                //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
                //Bind the Results to the Repeater
                Repeater1.DataSource = ds.Tables[3]; ;
            catch(Exception EX)
                throw EX;
        catch (Exception EX)
            throw EX;

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=, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
can any body describe the problem for me and gave me a solution

Posted 22-Sep-12 6:20am
Updated 22-Sep-12 6:41am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

This issue would happen when you download a file from Internet or Network Location, etc. Windows now preserves the zone information for file(s). This identifies where the file came from and displays appropriate warning messages, indicating you to be careful.

Resolution: Go to the properties of precompiled dll’s, check to see if it has following security message (at the bottom of the window): "This file came from another computer and might be blocked to help protect this computer." If present, click "Unblock", "Apply" and "OK".

Details, refer here: MSDN Blogs: System.Security.SecurityException: Request for the permission of type [^]
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Security issues can come from too many things to be able to give you an answer based on this, could you maybe provide the inner exception and/or stacktrace(s).

Even tho, I will give you some common issues I've encountered before:

Most security exceptions are related to cross origin problems, you are trying to download from, but you are not that same website. This get's blocked by either your application, your hosting provider, or the other party.
There is a configuration option somewhere to enable cross origin from your application outwards, but I don't remember what it was (sorry).
If it is your hosting provider, probably no/small chance they will change it for you.
If it is the other party, in this case Aljazeera, they probably done this for a reason. (In this case I doubt it is this last option tho)

Another cause can be the network security options from windows. On windows server the default option is to not trust remote sites, so you will need to either allow all remote sites (bad idea), or just add Aljazeera to the white list.

If you can provide more information, we can take a close look at the problem.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.171207.1 | Last Updated 22 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100