Click here to Skip to main content
15,898,987 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have one asp web page contains 2 text boxes,i will run that page and i will enter some data in those text boxes after that i will click button to store complete source code of that page along with text box values but now im not getting text box values...how to get those values along with source code..?
here is my code..

C#
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
         HttpWebResponse response = (HttpWebResponse)request.GetResponse();
         if (response.StatusCode == HttpStatusCode.OK)
         {
             Stream receiveStream = response.GetResponseStream();
             StreamReader readStream = null;
             if (response.CharacterSet == null)
                 readStream = new StreamReader(receiveStream);
             else
                 readStream = new StreamReader(receiveStream, Encoding.GetEncoding(response.CharacterSet));
             sourcecode = readStream.ReadToEnd();
             response.Close();
             readStream.Close();
         }


please help me
Posted
Updated 10-Jun-14 20:57pm
v2
Comments
Nirav Prabtani 11-Jun-14 2:59am    
can not understand what do you want??

1 solution

If I read you right, you can't do that.

What I think you are trying to do is open a website in your browser, have the user fill in the form details, then save the page including the form details the user entered by creating a new request for the page from the server.

That isn't how websites work: under normal circumstances, no user data is sent from the browser to the server until the user completes his input an initiates a post-back to the server (normally by clicking a button). Even then, it will be in a different session to the WebRequest you create here so that the two sets of input (as the server sees it) do not conflict with each other.

Try it: Open a browser window, fill in a form. Open a second browser window (or tab) and fill in the same form differently. The two versions are independent because they are in different sessions (unless the form / server uses cookies to store the data, as is common for shopping baskets because you want common data between them).

I'm not sure what you are trying to achieve with this, but I think you are going down totally the wrong route to achieve it!
 
Share this answer
 
Comments
Member 10877168 11-Jun-14 3:27am    
Actually i want to get web page source code along with the values in the text boxes but now im unable to get the values in the text boxes..

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