Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi Experts,
I developed my project using wcf services. I want code for run a web page in background at the time of running the service. Please help me ,
Thanks in advance

What I have tried:

I tried with below code
HttpWebRequest webRequestObject = null;
                            StreamReader sr = null;
                            HttpWebResponse webResponseObject = null;
                            webRequestObject = (HttpWebRequest)WebRequest.Create("http://localhost:27746/Textpage?Email="+Email+");
                            webRequestObject.Method = "POST";
                            webRequestObject.ContentType = "application/x-www-form-urlencoded";
                            Stream newStream = webRequestObject.GetRequestStream();

But i haven't able to know the webpage was run or not.
Posted
Updated 9-Aug-17 21:44pm

1 solution

Checkout below code. At the end of execution you will get web page response in htmlValue variable

var request = WebRequest.Create("http://google.com");

var response = request.GetResponse();
using (Stream responseStream = response.GetResponseStream())
{
 StreamReader reader = new StreamReader(responseStream);
 string htmlValue = reader.ReadToEnd();
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900