When you need to redirect to pages located at _layouts folder, the safest way is to use SPUtility.Redirect method. The following are sample to redirect to settings.aspx page:
SPUtility.Redirect("settings.aspx", SPRedirectFlags.UseSource | SPRedirectFlags.RelativeToLayoutsPage, HttpContext.Context);
If you want to redirect to custom pages at _layout folder, see below:
SPUtility.Redirect("sharepointmalaya/customadminsettings.aspx", SPRedirectFlags.Static | SPRedirectFlags.RelativeToLayoutsPage | SPRedirectFlags.RelativeToLocalizedLayoutsPage, HttpContext.Current);
Details on the SPRedirectFlags enumerations can be found here.
1 comment:
Just one note... in first redirection where you have HttpContext.Context should be HttpContext.Current :D
Post a Comment