在地址栏中看不到重定向的页面名称 [英] Unable to see the redirected page name in the address bar

查看:97
本文介绍了在地址栏中看不到重定向的页面名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有LinkBut​​ton的页面,我的要求是当我单击下载"时.该页面应使用Linkbutton重定向到另一个页面,并且应该下载我的文件,并且我的网页地址栏应显示该页面正在重定向的页面以及我的querystring值.请建议我该怎么做,请帮助我.

这是我的代码

FirstPage.aspx:

I have a page which has a LinkButton,my requirement is when i click on ''DownLoad; Linkbutton the page should redirect to another page and there my file should be download and my web page address bar should display that which page it is redirecting also my querystring value. please suggest me how would I do that please help me.

here is my code

FirstPage.aspx :

protected void LinkButton1_Click(object sender, EventArgs e) {

    Response.Redirect("Default2.aspx?filename=Csharp/CSharp.txt");              
}


Download.aspx:


Download.aspx :

protected void Page_Load(object sender, EventArgs e) 
{
    string filename = Request.QueryString["filename"];
    Response.ContentType = "text";
    Response.AppendHeader("Content-Disposition", "attachment; filename=CSharp.txt");
    Response.TransmitFile(Server.MapPath(filename));
    Response.End(); 
}


我在Download.aspx页面事件的每个事件中都使用了此代码,但我做不到.
注意:我确实有这个要求,我必须使用querystring,并且重定向的页面和querystring值也应该在下载之前显示在地址栏中.


I used this code in each and every event of Download.aspx page event but i couldn''t.
note:I have this requirement exactly that i have to use querystring and also the redirected page and querystring value should show in the address bar before download.

推荐答案

您"我试图在download.aspx中设置setTimeOut吗?我的意思是,当在此下载页面的on_load方法(代码隐藏)或javascript(客户端)中重定向到页面Download.aspx时,请等待几秒钟,然后再次调用以发送带有使它以这种方式下载文件的参数的页面您可以在浏览器中看到下载页面,请记住,如果某个页面包含下载开始,那么它的行为就像一个"transfer.page",希望对您有所帮助.让我们知道您是否找到了其他来自墨西哥的解决方案.
You''ve tried to setTimeOut within the download.aspx? I mean, when do the redirect to the page Download.aspx in on_load method (codebehind) or javascript (client) of this download page, a few seconds and call again to send the page with a parameter that makes it download the file that way you can see the download page in the browser remember that if a page contains a download start, this behaves as a "transfer.page" I hope and has helped you a little anyway. Let us know if you found another solution Regards From Mexico.


您可以做的是创建一个页面,该页面可以正常重定向,并且您可以使用客户端代码指向该文件.这样,浏览器将显示URL,也可以进行下载.
What you can do is to have a page where it redirects normally and you can use client side code to point to the file. In that way the browser will show the URL and the download will also be possible.


这篇关于在地址栏中看不到重定向的页面名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆