Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: .NET3.0
Hi All...,
 
      I want to Develop Windows application ,which works as it has some data fields (text Boxes, Combo boxes,...)same as web page in browser,we can retrieve data from Local database. i want to   Post This Data to corresponding fields of   webpage running in the browser ,Is it possible or not.......Please Suggest me How it will Do......
 

 

Regards.
SriramNidamanuri
Posted 16-Dec-11 20:23pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
v2
Comments
SriramNidamanuri at 17-Dec-11 5:59am
   
Thnks...Raja..., I saw Ur Solution,But I want To Post hues number of values at a time ,Is there any Another way to do it .....,How can use Plugins for this Work .... Thanks&Regards, SriramNidamanuri
SAKryukov at 18-Dec-11 1:20am
   
May be this is not quite clear or not complete. The article about query string shows how it is used in URL, but OP needs POST because Web form is mentioned in the question (or both). I think I explained what to do, please see my answer. --SA
SAKryukov at 18-Dec-11 2:08am
   
That's better (after the update), my 5. --SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Query string is not everything, and this is not main part and not always used. You really need to use the class System.Net.HttpWebRequest, but your compile-time variable will be of the class System.Net.WebRequest as the run-time type is defined by URI passed as a parameter of it factory method. Create, see:
http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.aspx[^],
http://msdn.microsoft.com/en-us/library/system.net.webrequest.aspx[^].
 
See the code sample in the second article referenced above, but this is for HTTP method 'get' (default), but you will need to use 'post'.
 
You can find a 'post' sample here: http://www.jigar.net/howdoi/viewhtmlcontent106.aspx[^]. Ignore that fact that this is ASP.NET sample — what's the difference.
 
Main thing you need to do is to find out what post string to write to the request string (again, see the sample above). It depends on the form data which is expected by the server part; and this is the data you will need to simulate in your request. Pay attention to the "name" attributes in your form. You will need to send those names and values by writing them in your request stream. Basically, the name/value pairs are written in the same format as the query string used in URL; look at the sample format string "field1={0}&field2={1}" in the code referenced above. In this example, the "name" attributes in the Web form's control are field1 and field2 and the values are defined by the input of the user of the Web form. You simulate this input using the post string like in the example shown above.
 
—SA
  Permalink  
Comments
thatraja at 18-Dec-11 2:05am
   
You right, I have updated my answer. 5!
SAKryukov at 18-Dec-11 2:08am
   
Thank you, Raja. --SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

alues by writing them in your request stream. Basically, the name/value pairs are written in the same format as the query string used in URL; look at the sample format string "field1={0}&field2={1}" in the code referenced above. In this example, t
  Permalink  
Comments
Abhishek Pant at 2-Jan-13 21:10pm
   
Compile your answer again seems that its not complete.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

Hello guys try this, this will work
 

HttpWebRequestuest Request = (HttpWebRequestuest)WebRequestuest.Create("www.YourSite.com/Post");
Request.Method = "POST";
byte[] byteArray = Encoding.UTF8.GetBytes(content);
Request.ContentType = "application/x-www-form-urlencoded";
Request.ContentLength = byteArray.Length;
Stream dataStream = Request.GetRequestuestStream();
dataStream.Write(byteArray, 0, byteArray.Length);
WebResponse response = Request.GetResponse();
dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string responseFromServer = HttpUtility.UrlDecode(reader.ReadToEnd());
reader.Close();
dataStream.Close();
response.Close();
Application.DoEvents();
  Permalink  

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Guruprasad.K.Basavaraju 450
1 Sergey Alexandrovich Kryukov 350
2 Shai Vashdi 318
3 OriginalGriff 265
4 Peter Leow 171
0 Sergey Alexandrovich Kryukov 9,109
1 OriginalGriff 5,290
2 Peter Leow 4,010
3 Maciej Los 3,535
4 Abhinav S 3,263


Advertise | Privacy | Mobile
Web03 | 2.8.140415.2 | Last Updated 8 Sep 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid