Response.Redirect不起作用

时间:2012-04-11 08:50:19

标签: c# asp.net response

我想知道为什么我的Response.Redirect不起作用。所以基本上,我读取了我的文件夹中的文件,或者完全是index.html。当我发现它重定向到它。

 foreach (System.IO.FileInfo thefile in fiArr)
        {
            if (thefile.Name == "index.html")
            {
                //Response.Redirect(path + "/index.html", false);
                Response.Redirect("C://inetpub//wwwroot//Folder//" + ((LinkButton)sender).ID,     false);
            }
        }

我只是想知道为什么这不会重定向到任何地方。

1 个答案:

答案 0 :(得分:7)

Response.Redirect仅支持重定向到以“http://”开头的URL,位于同一服务器上的虚拟文件夹或同一文件夹中的文件。

您可以将文件夹中的文件添加为服务器中的虚拟文件夹,然后重定向到文件的虚拟位置。

另一种方法可以是使用javascript来改为客户端重定向到文件。

相关问题