csharp-mvc: add jwt for download files

This commit is contained in:
Alexandr Fedorov
2021-04-21 12:42:22 +03:00
parent 1a825b9f17
commit a2116bf3f7
4 changed files with 43 additions and 5 deletions

View File

@ -254,6 +254,21 @@ namespace OnlineEditorsExampleMVC.Helpers
return createUrl.ToString();
}
public static string GetDownloadUrl(string fileName)
{
var downloadUrl = new UriBuilder(GetServerUrl(true))
{
Path =
HttpRuntime.AppDomainAppVirtualPath
+ (HttpRuntime.AppDomainAppVirtualPath.EndsWith("/") ? "" : "/")
+ "webeditor.ashx",
Query = "type=download"
+ "&fileName=" + HttpUtility.UrlEncode(fileName)
+ "&userAddress=" + HttpUtility.UrlEncode(HttpContext.Current.Request.UserHostAddress)
};
return downloadUrl.ToString();
}
public static string GetInternalExtension(FileUtility.FileType fileType)
{
switch (fileType)