Click here to Skip to main content
15,880,725 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

 
Share this answer
 
v2
Comments
SriramNidamanuri 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
Sergey Alexandrovich Kryukov 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
Sergey Alexandrovich Kryukov 18-Dec-11 2:08am    
That's better (after the update), my 5.
--SA
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
 
Share this answer
 
Comments
thatraja 18-Dec-11 2:05am    
You right, I have updated my answer.
5!
Sergey Alexandrovich Kryukov 18-Dec-11 2:08am    
Thank you, Raja.
--SA
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
 
Share this answer
 
Comments
Abhishek Pant 2-Jan-13 21:10pm    
Compile your answer again seems that its not complete.
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();
 
Share this answer
 
XML
hi guys i want to post data from my aspx page to online website which is

 <a href="http://eservice.dohms.gov.ae/pservices/CreatePID0.aspx"> 

is it possible to do so?
 
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