Visual Studio 2010的下Response.Redirect的复制在ASP.NET虚拟路径 [英] Virtual path duplicated in Response.Redirect in ASP.NET under Visual Studio 2010

查看:326
本文介绍了Visual Studio 2010的下Response.Redirect的复制在ASP.NET虚拟路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在与我的VS 2010的问题一个问题。
可以说,我有一个页面,MyPage.aspx,在网站上,MyWebSite,用,MyWebSitePath虚拟路径。
当我呼叫重定向到另一个页面,MyPage1.aspx,我的虚拟路径双打,我得到HTTP错误400 - 错误的请求,这是有道理的,因为我得到的链接 MyWebSite / MyWebSite / MyPage1.aspx

I'm having a problem with one of my VS 2010 problems. Lets say I have a page, MyPage.aspx, in web site, MyWebSite ,with virtual path of ,MyWebSitePath. When I redirect call to another page, MyPage1.aspx, my virtual path doubles and I get HTTP Error 400 - Bad Request, which makes sense because the Url I'm getting is MyWebSite/MyWebSite/MyPage1.aspx.

我用的Response.Redirect(〜/ MyPage1.aspx,真正的);

我已经试图与重定向页面的字符串玩。这并不是说,我猜它可能在SLN文件的地方,但我真的不知道。

I had already tried playing with the string of redirected page. It's not that, I'm guessing it's probably in the SLN file somewhere, but I really have no idea.

这是变酸code的一个例子:

An example of code that goes sour:

/// <summary>
/// Play audio file using response.redirect, can throw
/// </summary>
/// <param name="response">used to redirect to the created file path</param>
/// <param name="filePath"></param>
/// <param name="fileName"></param>
public static void PlayAudioFile(Page page, string filePath, string fileName) 
{        
    const string TempFolder ="tmp";
    string newPath = page.Server.MapPath(TempFolder);
    string newFileName = Guid.NewGuid().ToString() + fileName;
    System.IO.File.Copy(filePath +"\\" + fileName, newPath+"\\" + newFileName,true);
    page.Response.Redirect(TempFolder + "\\" + newFileName);
}

感谢在前进,
尤瓦

Thank in advance, Yuval

推荐答案

我花,但我终于想通了什么问题。
问题是这个小开溜(获取它开溜?):

It took forever but I finally figured out what was the problem. The problem was this little Bugger (Get it? bugger?):

 asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"          
 EnableScriptGlobalization="true"
        EnableScriptLocalization="true"
 /asp:ToolkitScriptManager>

当我打开它的非标准一切开始工作。
我很不幸,忽略了要说的是,这个项目是建立在其上迁移到VS2010 VS2008从与它的所有二进制文件一起,旧的项目。我没有深入研究,但似乎这是通过使用Ajax控件工具包的装配不良引起的版本。我的项目是.NET 4.0和工具包3.5。

When I switched it to the standart everything started to work. What I, unfortunately, neglected to say is that this project is built on an older project which was migrated to VS2010 from VS2008, along with all it's binaries. I hadn't researched thoroughly, but it seems that this is caused by using an ill fitting version of the Ajax Control Toolkit. My project is .Net 4.0 and the toolkit is 3.5.

感谢您的时间,
     尤瓦尔。

Thanks for all your time, Yuval.

这篇关于Visual Studio 2010的下Response.Redirect的复制在ASP.NET虚拟路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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