赖素文
authored
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
using System.Text;
namespace Microsoft.AspNetCore.Http
{
/// <summary>
/// 获取url地址
/// https://www.cnblogs.com/atree/p/netcore-absolute-uri.html
/// </summary>
public static class HttpRequestExtensions
{
public static string GetAbsoluteUri(this HttpRequest request)
{
return new StringBuilder()
.Append(request.Scheme)
.Append("://")
.Append(request.Host)
.Append(request.PathBase)
.Append(request.Path)
.Append(request.QueryString)
.ToString();
}
}
}
|