ASP.NET - Response redirect to different folder

user1055487 picture user1055487 · Dec 13, 2011 · Viewed 29.3k times · Source

I am attempting to redirect a gridview on selection. However, I am getting stuck on redirection when the page I am trying to redirect to is in a different folder.

The gridview is in a folder named HR. I am trying to redirect this to a file called Staff within a folder called Staff (Staff\Staff). How can I redirect to a different folder?

    If e.CommandName = "Select" Then
        'Add to session variable; translate the index of clicked to Primary Key
        Session.Add("DetailsKey", GridView1.DataKeys(e.CommandArgument).Value.ToString)
        Response.Redirect("staff\staff.aspx")
    End If

Answer

danludwig picture danludwig · Dec 13, 2011
Response.Redirect("~/staff/staff.aspx")