Click here to Skip to main content
15,886,740 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I am using an HTTPWebrequest for fetching a grid view data from a webpage.From a windows service I am sending this HTTP request for fetching gridview data.Below is my code

HttpWebRequest rqst = (HttpWebRequest)WebRequest.Create("http://localhost:50568/Home.aspx");
            rqst.Method = "POST";
            rqst.ContentType = "text/xml";
            rqst.ContentLength = 0;
            rqst.Timeout = 3000;

            var rspns = (HttpWebResponse)rqst.GetResponse();
            var reader = new StreamReader(rspns.GetResponseStream());
            string strOutput = reader.ReadToEnd();


But in this strOutput is not showing gridview data.Can you please help me to get a solution for this?

Thanks in advance
Posted
Comments
Ziee-M 17-Feb-14 5:54am    
Actually you are getting the source code of the page using the HttpWebRequest, you can use some scrapting(play with the source code using strings to get the content of Gridview). however, i don't think its the best solution.
kutz 2 17-Feb-14 6:03am    
Hi Ziee-M,Thank you for your reply.Can you please provide a code for this.Becuase I am new in this.
ZurdoDev 17-Feb-14 21:33pm    
1. Reply to the comment so that the user is notified.
2. Ziee-M is saying that your code is getting the html of a page which means there is no such thing as a gridview (since gridview is server side.) You'll end up with a table and you'll have to parse it to get the data you want.

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