r lo
r lo

Reputation: 316

Can't redirect from Web User Control

I have AppLogin.ascx in /WebControls/Login folder and want to redirect to a page /Users/Login.aspx and it will not redirect and sends me to my localhost. My web user control is used in ApplicationLogin.aspx in the /Users folder.

 If redirect Then
        Dim path As String = Server.MapPath("Login.aspx")
        Response.Redirect(path)
    End If

Upvotes: 0

Views: 139

Answers (1)

Kiran Hegde
Kiran Hegde

Reputation: 3681

Don't use Server.MapPath, which actually maps the page to physical directory of the page.Just use

Response.Redirect("~/Users/Login.aspx")

Upvotes: 1

Related Questions