G
Gabby Shainer
Hello,
I have an ASP.NET Web Service written in C# that does some processing and
then sends a request to an ISAPI Ext. (an HTTP Request).
The code form calling the ISAPI Ext. is as follows :
HttpWebRequest myHttpWebRequest = null;
HttpWebResponse myHttpWebResponse = null;
Stream receiveStream = null;
StreamReader readStream = null;
try
{
// Creates an HttpWebRequest with the specified URL.
myHttpWebRequest = (HttpWebRequest)WebRequest.Create(url);
// Sends the HttpWebRequest and waits for the response.
myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
// Gets the stream associated with the response.
receiveStream = myHttpWebResponse.GetResponseStream();
// Pipes the stream to a higher level stream reader with the required
encoding format.
readStream = new StreamReader(receiveStream);
aResults = readStream.ReadToEnd();
}
catch (System.Exception e)
{
System.Diagnostics.Trace.WriteLine(e.ToString());
aResults += "\n" + e.ToString();
// Releases the resources of the Stream.
if (readStream != null) readStream.Close();
// Releases the resources of the response.
if (myHttpWebResponse != null) myHttpWebResponse.Close();
return false;
}
// Releases the resources of the Stream.
if (readStream != null) readStream.Close();
// Releases the resources of the response.
if (myHttpWebResponse != null) myHttpWebResponse.Close();
The problem is that I get the following Exception:
System.Net.WebException: The remote server returned an error: (401)
Unauthorized.
at System.Net.HttpWebRequest.CheckFinalStatus()
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Net.HttpWebRequest.GetResponse()
at ArchiveSearchWebService.ArchiveSearchService.GetSearchResults(String
aQuery, String& aResults)
My ASP.NET Web Service allows anonymous access logged in as the ASPNET user,
and the ISAPI allows anonymous access logged in as the IUSR_<hostname> user.
Does anyone have an idea as to what my solution might be?
Thanks,
Gabby Shainer.
I have an ASP.NET Web Service written in C# that does some processing and
then sends a request to an ISAPI Ext. (an HTTP Request).
The code form calling the ISAPI Ext. is as follows :
HttpWebRequest myHttpWebRequest = null;
HttpWebResponse myHttpWebResponse = null;
Stream receiveStream = null;
StreamReader readStream = null;
try
{
// Creates an HttpWebRequest with the specified URL.
myHttpWebRequest = (HttpWebRequest)WebRequest.Create(url);
// Sends the HttpWebRequest and waits for the response.
myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
// Gets the stream associated with the response.
receiveStream = myHttpWebResponse.GetResponseStream();
// Pipes the stream to a higher level stream reader with the required
encoding format.
readStream = new StreamReader(receiveStream);
aResults = readStream.ReadToEnd();
}
catch (System.Exception e)
{
System.Diagnostics.Trace.WriteLine(e.ToString());
aResults += "\n" + e.ToString();
// Releases the resources of the Stream.
if (readStream != null) readStream.Close();
// Releases the resources of the response.
if (myHttpWebResponse != null) myHttpWebResponse.Close();
return false;
}
// Releases the resources of the Stream.
if (readStream != null) readStream.Close();
// Releases the resources of the response.
if (myHttpWebResponse != null) myHttpWebResponse.Close();
The problem is that I get the following Exception:
System.Net.WebException: The remote server returned an error: (401)
Unauthorized.
at System.Net.HttpWebRequest.CheckFinalStatus()
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Net.HttpWebRequest.GetResponse()
at ArchiveSearchWebService.ArchiveSearchService.GetSearchResults(String
aQuery, String& aResults)
My ASP.NET Web Service allows anonymous access logged in as the ASPNET user,
and the ISAPI allows anonymous access logged in as the IUSR_<hostname> user.
Does anyone have an idea as to what my solution might be?
Thanks,
Gabby Shainer.