User
User

Reputation: 281

Redirecting to the same sublayout in sitecore

Is it possible to redirect to the sublayout in sitecore? or I should redirect only to layouts. I have a sublayout in which user can add comments and see comments. I want to redirect to the same page when user click add button - to display his comment. In the code-behind of the sublayout I've wrote:

protected void Button1_Click(object sender, EventArgs e)
        {
            InsertInfo();
            Response.Redirect("/Layouts/Sublayouts/Mysublayout");
        }

But it doesn't work. Thanks in advance.

Upvotes: 0

Views: 369

Answers (1)

Derek Hunziker
Derek Hunziker

Reputation: 13141

If the goal is to reload the current page, use:

Sitecore.Web.WebUtil.ReloadPage();

If you need to persist any query strings that may be present, you can use:

var url = WebUtil.GetRawUrl();
Sitecore.Web.WebUtil.Redirect(url);

Upvotes: 4

Related Questions