Get HttpResponse from a page in the same web application

Posted by tivo on Stack Overflow See other posts from Stack Overflow or by tivo
Published on 2010-06-10T21:06:32Z Indexed on 2010/06/10 21:22 UTC
Read the original article Hit count: 281

Filed under:
|
|

I have the following code:

        HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create("http://mycomputer/myWebApp/WebPage2.aspx");

        myHttpWebRequest.Credentials = CredentialCache.DefaultNetworkCredentials;
        HttpWebResponse myHttpWebResponse = HttpWebResponse)myHttpWebRequest.GetResponse();

The last line of code throws a (500) Internal Server Error... This code is part of myWebApp/WepPage1.aspx, yes both aspx pages are on the same webapp.

What I want to accomplish is to get WebPage2.aspx html response, put it on an email and send it from WebPage1.aspx.

I would really appreciate any tips.. Thanks!!!

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about email