Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HttpWebResponse use in DLL returning "bad request" error

Status
Not open for further replies.

lsugirl

Programmer
May 24, 2004
24
US
I created a C# dll that get quote information from an external site. The url that is generated works through a regular browser but then I use the DLL (from an old FoxPro app), I get a "The remote server returned an error: (400) Bad Request." error. Here is the code I'm using in the DLL.

string uri=" + ConnStr.ToString();
System.Uri weburi = new System.Uri(uri,true);
try
{
System.Net.HttpWebRequest webrequest = (HttpWebRequest)System.Net.WebRequest.Create(weburi);
WebProxy myProxy=new WebProxy();
// Obtain the 'Proxy' of the Default browser.
myProxy=(WebProxy)webrequest.Proxy;
myProxy.Credentials = new NetworkCredential("internetuser", "internetuser", "corp");
webrequest.Proxy = myProxy;
System.Net.HttpWebResponse webresponse = (HttpWebResponse) webrequest.GetResponse();
.
.
.
Any suggestions? I have gotten the url that is passed and put it in my browser without any problem. I have referenced the dll in a .NET console app without any problems.

Thanks in advance.
 
I'm just throwing this one in...

... but then I use the DLL (from an old FoxPro app)...

But can you use a .net .dll in a non-.net program? I know that you can use non-.net .dll's by creating a .net wrapper for them... I don't think I've heard of anything for the reverse though...

(...wonder how many more times i could've written '.net' in that...) ;)

-----------------------------------------------
"The night sky over the planet Krikkit is the least interesting sight in the entire universe."
-Hitch Hiker's Guide To The Galaxy
 
Sorry. I meant I was using the C# dll IN an old Foxpro via a com wrapper.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top