Wednesday, November 7, 2012

How to solve error "The server committed a protocol violation. Section=ResponseHeader Detail=CR must be followed by LF"?

There are two ways to sovle the problem:
1: Add this setting into config file?
<configuration>
 <system.net>
  <settings>
   <httpWebRequest useUnsafeHeaderParsing="true" />
  </settings>
 </system.net>
</configuration>

2. Call following function first
        public static bool setAllowUnsafeHeaderParsing()
        {
            //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;
        }

How to install SOAP::Lite module into OTRS on Windows IIS server?


Run Perl\bin\ppm.bat as administrator
Search SOAP and install it

How to set up SOAP / Web service user for OTRS?

- Login into your existing OTRS Installation as Admin
- in the Menu under “Admin”->”Sysconfig” set Group to “Framework” and click “show”
- In the list of subgroups click “Core::SOAP”
- Check the boxes for SOAP::User: and SOAP::Password: and enter the values you like
- click update

http://www.iniy.org/?p=20

Where is database connection setting in OTRS?

Under folder:
\OTRS\Kernel

File name is config.pm

Reference:
http://doc.otrs.org/2.1/en/html/c1154.html

How to get download file length by WebClient?

            byte[] buffer;
            var client = new WebClient();
            buffer = client.DownloadData("http://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js");
            Stream strm = new MemoryStream(buffer);
            var fileLength = strm.Length;