且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我们可以使用Asp.Net 2.0编写浏览器网址吗

更新时间:2023-02-15 22:46:00

您可以简单地创建一个包含诸如"www.mypage.com/download.aspx?file=somefile.zip"之类的参数的页面,页面处理请求.如果要确保人们不能直接与其他人共享此链接,则可以创建一个简单的数据库表,该表包含一个数字和一个时间(最大有效时间),并且当用户请求文件时,它将在其中添加一条记录.数据库,当实际到达"download.aspx"时,您只需删除记录并提供请求的文件即可.如果该号码不存在,则将其重定向到您喜欢的某个页面.确保定期清理表以清除从未使用过的添加的记录.

祝你好运!
You can simply make a page that takes an argument like "www.mypage.com/download.aspx?file=somefile.zip" and let this page handle the request. If you want to ensure that people can''t share this link directly to someone else you could create a simple database table that holds a number and a time (max time valid) and when the user requests a file it will add a record to the database and when actually reaching the "download.aspx" you simply delete the record and give the requested file. If the number doesn''t exists you redirect them to some page you like. Be sure to cleanup the table regularly to clear added records that where never used.

Good luck!


是的,有可能.您需要阅读有关URL重写的信息.

在此处阅读有关信息: MSDN:URL重写 [
Yes, it is possible. You need to read about URL Rewriting.

Read about it here: MSDN: URL Rewriting[^]