HttpContext.Current.Server.UrlEncode
Sadece .NET Framework'te çalışır. ASP.NET Core projesinde uri argümanlarını nasıl kodlayabilirim veya çözebilirim?URL Encode ve ASP.NET Çekirdeğinde Kod Çözme
HttpContext.Current.Server.UrlEncode
Sadece .NET Framework'te çalışır. ASP.NET Core projesinde uri argümanlarını nasıl kodlayabilirim veya çözebilirim?URL Encode ve ASP.NET Çekirdeğinde Kod Çözme
Microsoft.AspNetCore.WebUtilities
Nuget paketini ekledikten sonra WebUtility
sınıf mevcuttur:
public static class WebUtility
{
public static string UrlDecode(string encodedValue);
public static string UrlEncode(string value);
}
SDK 2.0.0 + 'ya karşı benim için çalışmadı, ancak Manuel Alves (System.Net.WebUility) yanıt verdi. –
O System.Net.WebUtility.UrlEncode içinde, version 2.0.0 of the .Net Core SDK bulunanlarda
ASP.NET Çekirdek hiçbir HttpContext yoktur
- veya Web dışı herhangi bir proje. Aynı yöntem Uri sınıfının yöntemleri ile kullanılabilir, örneğin [Uri.EscapeDataString] (https://msdn.microsoft.com/en-us/library/system.uri.escapedatastring (v = vs.110) .aspx), [Uri.EscapeUriString] (https://msdn.microsoft.com/en-us/library/system.uri.escapeuristring (v = vs.110) .aspx) –
@PanagiotisKanavos YANLIŞ - HttpContext yok. Current' ama 'HttpContext' .Net Core -' Microsoft.AspNetCore.Http.HttpContext' bir parçasıdır. Unutmayın bu –
Yorumun tamamını okumak için unutmayın. Bahsettiğiniz HttpContext * ÇOK * önceki sürümlerin HttpContext farklıdır. Uri yöntemleri –