thirunavukaras 0 Newbie Poster

Hai,,

i want to post data with screen scrap page..

i want to send from to destination station which class and date...

i run the screenscrap.aspx page the posted data send to the request page with to display the posted page

that is searched page..)

here my code..

ScrapPage.aspx....

Public Sub SubmitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SubmitButton.Click

Dim RequestUrl As String = "http://www.indianrail.gov.in/src_dest_trns.html"

Dim Post As String = "lccp_src_stncode=" & "ms" & "lccp_dstn_stncode=" & "vpt" & "lccp_classopt=" & "SL" & "lccp_day=" & "27" & "lccp_month=" & "May"


Dim Writer As StreamWriter = Nothing

Dim WebRequestObject As HttpWebRequest

Dim sr As StreamReader

Dim WebResponseObject As HttpWebResponse


Try

WebRequestObject = CType(WebRequest.Create(RequestUrl), HttpWebRequest)

WebRequestObject.Method = "POST"

WebRequestObject.ContentType = "application/x-www-form-urlencoded"

WebRequestObject.ContentLength = Post.Length

Writer = New StreamWriter(WebRequestObject.GetRequestStream())

Writer.Write(Post)

Writer.Close()

WebResponseObject = CType(WebRequestObject.GetResponse(), HttpWebResponse)

sr = New StreamReader(WebResponseObject.GetResponseStream)

Dim Results As String = sr.ReadToEnd

WebResponseLabel.Text = Results

WebResponseText.Text = Results

Finally

Try

sr.Close()

Catch

End Try

Try

WebResponseObject.Close()

WebRequestObject.Abort()

Catch

End Try

End Try

----------------------------------------------

<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">

<asp:button id="SubmitButton" onclick="SubmitButton_Click" Text="Get IRTC Search Booked Tickets"
Runat="server"></asp:button><br>
<asp:textbox id="WebResponseText" Runat="server" TextMode="MultiLine" Height="300" Width="780"></asp:textbox><asp:label id="WebResponseLabel" Runat="server"></asp:label></form>
</body>

i want to post data to the request url to view posted page....

please help me....