samjudson / flickr-net

Home of the FlickrNet API libary

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

For security reasons DTD is prohibited in this XML document

kutoswiss opened this issue · comments

commented

Hi,
When I deploy my web application (ASP.NET MVC) on production, I have the following error when I try to get pictures from a Controller:

For security reasons DTD is prohibited in this XML document. To enable DTD processing set the DtdProcessing property on XmlReaderSettings to Parse and pass the settings into XmlReader.Create method.

Source Error:

[HttpGet]
public JsonResult Search(String q, int page = 1)
{
     Dictionary<String, Object> result = new Dictionary<string, object>();

     this.FlickrSearchOptions = new PhotoSearchOptions(FLICKR_USER_ID);
     this.FlickrSearchOptions.Text = q;
     this.FlickrSearchOptions.PerPage = AMOUNT_PICTURES_PER_PAGE;
     this.FlickrSearchOptions.Page = page;

     // Error occurs after this line
     this.FlickrPhotoCollection = this.Flickr.PhotosSearch(this.FlickrSearchOptions); 

     result.Add("results", this.FlickrPhotoCollection);
     return Json(result, JsonRequestBehavior.AllowGet);
}

Stack Trace:

[XmlException: For security reasons DTD is prohibited in this XML document. To enable DTD processing set the DtdProcessing property on XmlReaderSettings to Parse and pass the settings into XmlReader.Create method.]
   System.Xml.XmlTextReaderImpl.Throw(Exception e) +72
   System.Xml.XmlTextReaderImpl.ThrowWithoutLineInfo(String res) +104
   System.Xml.XmlTextReaderImpl.ParseDoctypeDecl() +5524071
   System.Xml.XmlTextReaderImpl.ParseDocumentContent() +562
   System.Xml.XmlTextReaderImpl.Read() +163
   System.Xml.XmlReader.ReadToDescendant(String name) +110
   FlickrNet.FlickrExtensions.Load(IFlickrParsable item, String originalXml) +383
   FlickrNet.Flickr.GetResponse(Dictionary`2 parameters, TimeSpan cacheTimeout) +805
   FlickrNet.Flickr.PhotosSearch(PhotoSearchOptions options) +107

However, everything is working well on localhost.

commented

Sorry, the problem was on the proxy side.
api.flickr.com was categorized as Social Networking which is not allowed by default on the proxy.

Thanks. I was going to say it was something to do with Medium Trust environment, but I haven't seen anyone have a problem with that in a while.