2.1Getting Website Content

Created on Aug 17, 2026~2 min read

Getting website content is a common requirement, for example getting the homepage content of the Furion framework website (https://furion.net). The following shows several ways to achieve this using httpRemoteService.

cs
// Get the string content directlyvar content = await httpRemoteService.GetAsStringAsync("https://furion.net");

In addition to the above method, the following approaches are also supported:

1. Using the builder approach ✅

  • Get the string-type content directly:
cs
var content = await httpRemoteService.SendAsStringAsync(HttpRequestBuilder.Get("https://furion.net"));// var content = await httpRemoteService.SendAsStringAsync(HttpBuilder.Get("https://furion.net")); // HttpBuilder can be used instead of HttpRequestBuilder
  • Specify the string type via generics:
cs
var content = await httpRemoteService.SendAsAsync<string>(HttpRequestBuilder.Get("https://furion.net"));
  • Get the HttpRemoteResult<T> type and extract the result from it:
cs
var result = await httpRemoteService.SendAsync<string>(HttpRequestBuilder.Get("https://furion.net"));var content = result.Result;
  • Get the HttpResponseMessage type and read its content:
cs
var httpResponseMessage = await httpRemoteService.SendAsync(HttpRequestBuilder.Get("https://furion.net"));var content = await httpResponseMessage.Content.ReadAsStringAsync();

2. Using the request verb approach

  • Specify the string type via generics and get it directly:
cs
var content = await httpRemoteService.GetAsAsync<string>("https://furion.net");// Configure HttpRequestBuilder// var content = await httpRemoteService.GetAsAsync<string>("https://furion.net", builder => builder.Profiler());// ✅ Syntactic sugar: HttpRequestBuilder.Setup or HttpBuilder.Setup can be used instead of the builder => builder syntax// var content = await httpRemoteService.GetAsAsync<string>("https://furion.net", HttpBuilder.Setup.Profiler());
  • Get the HttpRemoteResult<T> type and extract the result from it:
cs
var result = await httpRemoteService.GetAsync<string>("https://furion.net");var content = result.Result;
  • Get the HttpResponseMessage type and read its content:
cs
var httpResponseMessage = await httpRemoteService.GetAsync("https://furion.net");var content = await httpResponseMessage.Content.ReadAsStringAsync();

These approaches offer flexible options, so you can choose the method best suited to your specific needs to get website content.