내 VS 2010 문제 중 하나에 문제가 있습니다. MyWebSitePath의 가상 경로가있는 웹 사이트 MyWebSite에 MyPage.aspx라는 페이지가 있다고 가정 해 보겠습니다. 다른 페이지, MyPage1.aspx에 대한 호출을 리디렉션하면 가상 경로가 두 배가되고 HTTP 오류 400 - 잘못된 요청이 표시됩니다. 이는 내가 얻는 URL이 MyWebSite/MyWebSite/MyPage1.aspx
이기 때문에 의미가 있습니다.Visual Studio 2010에서 ASP.NET의 Response.Redirect에 복제 된 가상 경로
나는 이미 리디렉션 페이지의 문자열을 가지고 노는 시도했다 Response.Redirect("~/MyPage1.aspx",true);
를 사용합니다. 그것은 아닙니다, 아마도 SLN 파일에있는 것 같아요.하지만 정말 모르겠습니다.
신가는 코드의 예 :하지만 결국 문제가 무엇인지 알아 냈어 그것은 영원히 갔다 사전에
/// <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);
}
감사, Yuval 교수
사용중인 전체 코드가 맞습니까? 의사 코드가 아닌 실제 코드를 보여주십시오. 이것은 분명히 표준적인 동작이 아니기 때문입니다. – walther
Eaxctly이 오류를 발생시키는 행은 무엇입니까? – akhil
제발 부끄러워하지 마라. 코드를 보여줘. ... – akhil