I have the following code in my page:
if (Request.QueryString("link_id") == "12345" )
{
Responce.Redirect("http://www.downloadsite.com/blablabla.png");
}
Now I want to hide that URL when somebody adds this link to his internet download manager :
http://www.mysite.com?link_id=12345
as you see the goal domain in different, I just want prevent my users to share my links.
Thanks in advance.
If I understand the question, you're trying to let the user download a file from http://www.downloadsite.com/blablabla.png
that appears to the user, in every sense, to be coming from http://www.mysite.com?link_id=12345
. This is what I'd try:
if (Request.Params["link_id"] == "12345")
{
Uri uri = new Uri("http://www.downloadsite.com/blablabla.png");
using (var wc = new WebClient())
using (var download = wc.OpenRead(uri))
using (var respStream = Response.OutputStream)
download.CopyTo(respStream);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.