如何使用C#制作虚假Url
本文关键字:Url 何使用 | 更新日期: 2023-09-27 18:19:45
我想在网上为我的位置文件创建一个假路径
例如,我的文件位于地址:
root'a'b.jpg
但我想展示一下:
root'{ 16 Random Character } b.jpg
事实上是为了更大的安全性。与dropbox共享相同。
您不需要生成随机文件夹,只需要将文件二进制数据传递给浏览器,浏览器就会下载它,而不会显示所述文件的实际位置。更多信息。
的简短示例
private void Page_Load(object sender, System.EventArgs e)
{
//Set the appropriate ContentType.
Response.ContentType = "Application/pdf";
//Get the physical path to the file.
string FilePath = MapPath("acrobat.pdf");
//Write the file directly to the HTTP content output stream.
Response.WriteFile(FilePath);
Response.End();
}