Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Accessing an ISAPI Ext. through an ASP.NET Web Service

Reply
Thread Tools

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

 
 
Gabby Shainer
Guest
Posts: n/a
 
      11-04-2003
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(IAsyncRes ult asyncResult)
at System.Net.HttpWebRequest.GetResponse()
at ArchiveSearchWebService.ArchiveSearchService.GetSe archResults(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.


 
Reply With Quote
 
 
 
 
Gabby Shainer
Guest
Posts: n/a
 
      11-04-2003
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.

"Gabby Shainer" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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(IAsyncRes ult asyncResult)
> at System.Net.HttpWebRequest.GetResponse()
> at ArchiveSearchWebService.ArchiveSearchService.GetSe archResults(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.
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to post a web form to an external isapi? Řystein Olsen ASP .Net 3 07-24-2006 06:02 PM
How to Accessing a Web Service Through a Proxy Server? mizi ASP General 1 07-24-2006 06:32 AM
How to call C# web service in an unmanaged c++ ISAPI filter dkpatt@gmail.com ASP .Net Web Services 0 04-14-2006 05:46 PM
InvocationTargetException when calling "new Service()" in Axis web service to call another web service Michael Averstegge Java 0 01-10-2006 11:05 PM
Accessing LAN from the page through Web Service JP ASP .Net 1 08-20-2003 01:45 PM



Advertisments