![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Professional Programmer
Join Date: Sep 2005
Location: serbia & montenegro
Posts: 484
Rep Power: 4
![]() |
c# and web forms
Hi,
I want to use web form in this page http://www.belestrane.nadlanu.com/site/ in my c# application. I need to somehow post the data from controls in the app and then output them on a listbox. I think i should use webservices but I am not sure. Thank you
__________________
ivankorhner.co.sr |
|
|
|
|
|
#2 |
|
Battle Programmer
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 763
Rep Power: 3
![]() |
Re: c# and web forms
You mean you want to use that form in a C# client application? If so, you'll need to recreate the form in your app; there isn't a way to randomly include the webform data in your C# app. If you're trying to get it through a service, there needs to be a service there already; it will have a separate URL than the webpage.
__________________
<insert disclaimer here> <insert shameless plug for Visual Studio here> |
|
|
|
|
|
#3 | |
|
Professional Programmer
Join Date: Sep 2005
Location: serbia & montenegro
Posts: 484
Rep Power: 4
![]() |
Re: c# and web forms
Quote:
Thanks for your answer. I am trying to get the data by a http POST method. With some packet sniffing i have found out how to send the variables but seems like I am not getting a correct response. Here is some code: WebRequest wReq = WebRequest.Create("http://www.telekom.yu/WhitePages/ResultPage.asp");
wReq.Method = "POST";
wReq.UseDefaultCredentials = true;
string postData = "Telefon=&Ulica=&MG=022&Ime=&Broj=&Mesto=&Prezime=KORHNER";
byte[] byteArray = Encoding.UTF8.GetBytes(postData);
wReq.ContentType = "application/x-www-form-urlencoded";
wReq.ContentLength = byteArray.Length;
Stream dataStream = wReq.GetRequestStream();
dataStream.Write(byteArray, 0, byteArray.Length);
dataStream.Close();
WebResponse wRes = wReq.GetResponse();
this.Text = ((HttpWebResponse)wRes).StatusDescription.ToString();
dataStream = wRes.GetResponseStream();
StreamReader stReader = new StreamReader(dataStream);
txtOutput2.Text = stReader.ReadToEnd();
stReader.Close();
dataStream.Close();
wRes.Close();
__________________
ivankorhner.co.sr |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|