Asked by:
Get value from external URL ASP.net Vb.net

Question
-
User-504694704 posted
Hi Fei Han,
I have web system developed by vb.net and asp.net the home page is "http://TestCall/WebForm1.aspx"
and i have web service url http link, send mobile number every call center ringing "http://TestCall/WebForm1.aspx?Mobile=7985645251"
How i can get mobile value and display in the test box in home page ??
to be informed the web system already running .
Thanks.
Wednesday, October 17, 2018 9:05 AM
All replies
-
User61956409 posted
Hi Mohannad S,
Welcome to ASP.NET forums.
How I can gets value from external URL to display on the home page inside
TextBox?If you'd like to consume an external service to get the data and display the returned data in a TextBox from you vb.net webform application, you can refer to the following code snippet:
Dim client As HttpClient = New HttpClient() Dim Response As HttpResponseMessage = client.GetAsync("http://xxxx/api/getdata").Result If Response.IsSuccessStatusCode Then TextBox1.Text = Response.Content.ReadAsStringAsync().Result End If
Besides, if you'd like to make request from JavaScript client-side to get the data, you can use jQuery.ajax().
With Regards,
Fei Han
Wednesday, October 17, 2018 10:04 AM -
User-504694704 posted
Thank you for replay,
Any library should be added before ?? be the "HttpClientcause" is not defined.
Wednesday, October 17, 2018 11:09 AM -
User-369506445 posted
hi
for use <g class="gr_ gr_21 gr-alert gr_gramm gr_inline_cards gr_run_anim Style multiReplace" id="21" data-gr-id="21">HttpClient ,</g> you have to Add below assembly
System.Net.Http
Wednesday, October 17, 2018 11:15 AM -
User61956409 posted
Hi Mohannad S,
Any library should be added before ??As vahid bakkhi mentioned, you should add and import System.Net.Http, like below.
Imports System.Net.Http
With Regards,
Fei Han
Thursday, October 18, 2018 1:32 AM -
User-369506445 posted
You can get the query string below like
TextBox1.Text = Request.QueryString("Mobile")
Thursday, October 18, 2018 8:10 PM -
User61956409 posted
Hi Mohannad S,
send mobile number every call center ringing "http://TestCall/WebForm1.aspx?Mobile=7985645251"
How i can get mobile value and display in the test box in home page ??
You can use the following code to get the QueryString and display it in your TextBox control.
If Request.QueryString.Get("Mobile") IsNot Nothing Then TextBox1.Text = Request.QueryString.Get("Mobile").ToString() End If
Test Result:
With Regards,
Fei Han
Friday, October 19, 2018 1:47 AM -
User-504694704 posted
Hi Fei Han,
I tried (Request.QueryString.Get) before but the web page gets the mobile value just first time, when the web service send anther mobile number the (Request.QueryString)
can't display on the textbox.
Saturday, October 20, 2018 6:38 AM -
User61956409 posted
Hi Mohannad S,
I tried (Request.QueryString.Get) before but the web page gets the mobile value just first time, when the web service send anther mobile number the (Request.QueryString)
Please clarify your actual scenario and requirement. And please tell us how and where you call the web service to send mobile number.
With Regards,
Fei Han
Monday, October 22, 2018 2:40 AM -
User-504694704 posted
Hi Fei Han,
Once the telephone start riming the windows service catch the phone number and send it to the my home page which is developed by ASP.net and VB.net.
and my home page always running wetting the request mobile number from windows service (which is developed by JAVA).
My need is: get the phone number from this windows service and put this number in textbox in my asp home page.
Regards,
Monday, October 22, 2018 8:38 AM -
User61956409 posted
Hi Mohannad S,
My need is: get the phone number from this windows service and put this number in textbox in my asp home page.It seems that you'd like to get the phone number from your windows service and push the phone number to an existing web page that you opened before. If so, you can try to use ASP.NET SignalR to implement this functionality.
1) map browser client to connectionid
2) add queue message after the windows service get a phone number, and specify which client (via connectionid) should receive this number
3) use a queue triggered job to handle queue message, and call hub server method to push the phone number to specific client
4) in web application client side, dynamically assign phone number as value of TextBox control once the client received the pushed message
With Regards,
Fei Han
Tuesday, October 23, 2018 2:12 AM -
User-504694704 posted
Hi,
Thank you dear.
can you give me a sample, i have not used SignalR before.
Thanks,
Tuesday, November 27, 2018 11:40 AM