Calling .ASP pages

  • Thread starter Thread starter Joe Reazor
  • Start date Start date
J

Joe Reazor

I know you can't use Server.Execute to call an ASP page, so I have tried
using the HttpWebRequest and HttpWebResponse objects to do so. The trouble
is that the asp page that I need to call is password protected. When I call
GetResponse on the HttpWebRequest object I get the login page that a normal
user would be redirected to. I am not sure how to work around this. Anyone
have any thoughts?

TIA
==============
Joe Reazor
Gorbel Inc.
email: joerea AT gorbel DOT com
 
Thanks for the article. I pretty much figured all of this out already
regarding the HttpWebRequest/Response objects. The one thing that the
article does not address is forms based authentication. It has basic and
ntlm but not forms based. I thought that I could somehow retrieve the
cookie that the forms based authentication sets in my originating aspx page
by getting the cookies from that page's Request object and then iterating
through them to add them to the cookies of the HttpWebRequest object, but
that doesn't seem to work. It keeps giving a very useless error that says
nothing more than "cookie.domain", which doesn't help me much. So I guess I
am at a loss of how to do this.


==============
Joe Reazor
Gorbel Inc.
email: joerea AT gorbel DOT com
 
Nevermind. I figured this out. The issue was that the cookies contained in
the Page.Request.Cookies object all had null Domain properties, but the
HttpWebRequest.CookieContainer cookies needed to have a domain and the
domain had to match the site that I was already logged into. To get this to
work I simply used the Request.Url.Host property to get the host and set the
domain for all the cookies I created to this value. And that did the trick,
no errors and I didn't get the login page anymore.


==============
Joe Reazor
Gorbel Inc.
email: joerea AT gorbel DOT com
 
Back
Top