In my project I use http api which returns xml responce. The problem is that the http addresses have significant number of parameters and are too long. Thats whay I get this error:
The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
I tried in webconfig file to write:
<httpRuntime maxUrlLength="1000" relaxedUrlToFileSystemMapping="true"/>
Didn't work..
I tryed putting the long string into a uri but then visual studio tells about an error and wants a string.
Here's my code
string encoded = Server.UrlEncode("https://test.httpapi.com/api/domains/register.xml?auth-userid=0&auth-password=password&domain-name=domain.asia&years=1&ns=ns1.domain.com&ns=ns2.domain.com&customer-id=0®-contact-id=0&admin-contact-id=0&tech-contact-id=0&billing-contact-id=0&invoice-option=KeepInvoice&protect-privacy=true");
try
{
XmlDocument doc = new XmlDocument();
doc.Load(encoded);
....other code to get the loaded xml data....
}
I need a way to work around this limitation for < 260 characters. The string I posted is only a demo, my string is even longer after I add all the variables. I did a lot of search for this problem and got nothing, even tryed the "\\?\" witch is a work around but not for a http path. Please help..