How does Response.Redirect calculate the URL for "~/folder1/folder2/some.aspx"
        Posted  
        
            by 
                Chris Marisic
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Chris Marisic
        
        
        
        Published on 2011-01-10T20:49:32Z
        Indexed on 
            2011/01/10
            20:53 UTC
        
        
        Read the original article
        Hit count: 227
        
This might sound like a trivial problem but for some reason it is not.
Instead of needing to redirect
Response.Redirect("~/folder1/folder2/some.aspx")
I need the location as if it behaved like
string navigatingUrl = Response.Redirect("~/folder1/folder2/some.aspx")
Trying to replicate this I started with
string navigatingUrl = new Uri(HttpContext.Current.Request.Url,
                     new Uri("~/folder1/folder2/some.aspx", UriKind.Relative));
This instead generates "http://www.fullRequestUrl/~/folder1/folder2/some.aspx"
© Stack Overflow or respective owner