Reputation: 676
I would like to put a form on my page. There will be an input box and a submit button. When the user enter a specific id then i will take that id put it in a url and display the result from that url.
Let say user enter this: 12345678.
Then i want to take that id display the result from
http://foo.com/servlet/AccessModule?id=12345678&doc_type=pdf&sort1=capturedate&response=A on my page using asp.net technologies.
I already tried a couple of things but couldnt figure this out.
Can you please comment.
Upvotes: 0
Views: 635
Reputation: 357
Here is how it could work. This needs some polishing but you should be able to bring it to completion yourself.
Copy this into .aspx page
<form id="form1" runat="server">
<div>
<asp:TextBox runat="server" ID="txtInput"></asp:TextBox><br /><br />
<asp:Button runat="server" ID="btnSubmit" Text="Submit"
onclick="btnSubmit_Click" /><br /><br />
<asp:Label runat="server" ID="lblResult" Text=""></asp:Label>
</div>
</form>
And this into code behind (I’m assuming you’re using C#)
protected void btnSubmit_Click(object sender, EventArgs e)
{
System.Net.WebClient wc = new System.Net.WebClient();
lblResult.Text =
wc.DownloadString(string.Format("http://foo.com/servlet/AccessModule?id={0}&doc_type=pdf&sort1=capturedate&response=A", txtInput.Text));
}
Upvotes: 1
Reputation:
When you send an http request it reaches the server on port 8080. You can not specify the port that you are going to use. To pass parameters in URL you have to use this
repsonse.redirect("AccessModule.aspx?id=12345678&doc_type=pdf&sort1=capturedate&response=A");
Upvotes: 1
Reputation: 553
<form action="www.foo.com/search" method="get">
ID: <input type="text" name="id"><br>
<input type="submit" value="Submit">
</form>
Upvotes: 1