Get whole html page with values in Code behind.


Hello, 

I want to get all HTML code with values entered by user in code behind as it is,

Actully this need has arised when I want to send a mail to a given mail id, the whole HTML page as it is (same UI) with entered values.  

For this I hv written following code, but it only gives the HTML and not the values user has entered.

------------------------------------------------------------------------------------------------------------------------------------------------------ 

private
String readHtmlPage(string url)

{

String result = "";

String strPost = "x=1&y=2&z=YouPostedOk";

StreamWriter myWriter =
null;

 

HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(url);

objRequest.Method = "POST";

objRequest.ContentLength = strPost.Length;

objRequest.ContentType = "application/x-www-form-urlencoded";

objRequest.Credentials = CredentialCache.DefaultCredentials;

try

{

myWriter =
new StreamWriter(objRequest.GetRequestStream());

myWriter.Write(strPost);

}

catch (Exception e)

{

return e.Message;

}

finally

{

myWriter.Close();

}

 

HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();

using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()) )

{

result = sr.ReadToEnd();

// Close and clean up the StreamReader

sr.Close();

}

return result;

}

------------------------------------------------------------------------------------------------------------------------------------------------------

Please help me out for finding the values in the controls as well as html code.

It's really very URGENT, PLEASE Help ASAP.

Thanks in advance.

 

0
abhijeet_beedkar
2/13/2008 11:54:55 AM
asp.net.web-forms 93655 articles. 5 followers. Follow

1 Replies
835 Views

Similar Articles

[PageSpeed] 56

Hi abhijeet_beedkar,

Base on my experience, perhaps the following link can help you to solve your problem, the link talk about "Last second HTML changes in your ASP.NET page".

http://www.aspcode.net/Last-second-HTML-changes-in-your-ASPNET-page.aspx

Let me know if I have misunderstood what you mean. Thanks.

Hope it helps,

Hong Gang 


 


Hong-Gang Chen
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
0
Hong
2/15/2008 6:29:06 AM
Reply: