locked
Get Rss Feed data on cross domain in .Net 1.1 RRS feed

  • Question

  • Hi,

    I'm currently using .Net 1.1 for code development and plan to get Rss feed data on another website. Using  HttpWebRequest on  WebRequest.Create("url") will return an error stating - "Additional information: Unrecognized attribute 'useUnsafeHeaderParsing'", then I  checked the web.config and 'useUnsafeHeaderParsing setting was already set to true. I found a blog that this can be overridden to change during run time but it is on .Net 2.0.   

    There is also an API URL that I can used to get the json data but jsonp is not supported in .Net 1.1. Please advise. Thanks.
    Thursday, July 16, 2015 6:45 PM

All replies

  • Hello,

    You mean you use WebRequest to sent requests in your client application and  target your client application to .Net 1.1? Please try the answer in this thread:

    https://social.msdn.microsoft.com/Forums/en-US/ff098248-551c-4da9-8ba5-358a9f8ccc57/how-do-i-enable-useunsafeheaderparsing-from-code-net-20?forum=netfxnetcom

    Set useUnsafeHeaderParsing to true by using reflection.

    public static bool SetAllowUnsafeHeaderParsing20()
    {
      //Get the assembly that contains the internal class
      Assembly aNetAssembly = Assembly.GetAssembly(typeof(System.Net.Configuration.SettingsSection));
      if (aNetAssembly != null)
      {
        //Use the assembly in order to get the internal type for the internal class
        Type aSettingsType = aNetAssembly.GetType("System.Net.Configuration.SettingsSectionInternal");
        if (aSettingsType != null)
        {
          //Use the internal static property to get an instance of the internal settings class.
          //If the static instance isn't created allready the property will create it for us.
          object anInstance = aSettingsType.InvokeMember("Section",
            BindingFlags.Static | BindingFlags.GetProperty | BindingFlags.NonPublic, null, null, new object[] { });
    
          if (anInstance != null)
          {
            //Locate the private bool field that tells the framework is unsafe header parsing should be allowed or not
            FieldInfo aUseUnsafeHeaderParsing = aSettingsType.GetField("useUnsafeHeaderParsing", BindingFlags.NonPublic | BindingFlags.Instance);
            if (aUseUnsafeHeaderParsing != null)
            {
              aUseUnsafeHeaderParsing.SetValue(anInstance, true);
              return true;
            }
          }
        }
      }
      return false;
    }


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.



    Friday, July 17, 2015 6:43 AM
    Moderator
  • Hi Caillen,

    Thanks for sharing. I've already tried the thread above but  it is for .Net 2.0. I'm using .Net 1.1 for my web application which the Assembly class is not available.

    Regards,

    Max

    Friday, July 17, 2015 2:26 PM