Tomasi - Developing 35e83c4735 beta 0.0.3
2024-11-26 08:43:01 +01:00

22 lines
513 B
C#

using System.Web;
namespace Application.Helpers;
public static class HttpExtensions
{
public static Uri AddQueryParam(this Uri uri, string name, string value)
{
var httpValueCollection = HttpUtility.ParseQueryString(uri.Query);
httpValueCollection.Remove(name);
httpValueCollection.Add(name, value);
var uriBuilder = new UriBuilder(uri)
{
Query = httpValueCollection.ToString() ?? string.Empty,
};
return uriBuilder.Uri;
}
}