Accessing an ISAPI Ext. through an ASP.NET Web Service

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.
 
G

Gabby Shainer

I have set the login for the anonymous user on the ISAPI to the ASPNET user
and set the "allow IIS to control password" checkbox to on.
The HTTP request seem to work fine now.

Another problem I'm experiencing now is that when the ISAPI calls a DCOM
server during its run I get an 80070005 (ACCESS DENIED) error from the DCOM
server.
I have given ASPNET both launch and access priveleges on the DCOM server
(using dcomcnfg).

Could anyone help me on this one?

Gabby.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top