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
.
I use Response.Redirect("~/MyPage1.aspx",true);
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.
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