0

I have created a Custom Action which appears on "Site Actions" and when you click on it, it opens a modal diaglog which is a Application Page. within this Application Page I want to redirect to ~site/_layouts/newsbweb.aspx. I have tested following but no success.

 Response.Redirect("/_layouts/newsbweb.aspx", true);

How do I get HttpContext in Application Page.

SPUtility.Redirect("~site/_layouts/newsbweb.aspx", SPRedirectFlags.Trusted, ???)
  • SPUtility.Redirect("~site/_layouts/newsbweb.aspx", SPRedirectFlags.Trusted, HttpContext.Current); – user2536 Oct 2 '12 at 12:31
3

you can try the following:

SPUtility.Redirect("newsbweb.aspx", SPRedirectFlags.Static | SPRedirectFlags.RelativeToLayoutsPage | SPRedirectFlags.RelativeToLocalizedLayoutsPage, HttpContext.Current);

http://msdn.microsoft.com/en-us/library/ms463664.aspx

https://www.nothingbutsharepoint.com/sites/devwiki/SP2007Dev/Pages/How%20to%20use%20SPUtility.Redirect.aspx

or

HttpContext.Current.Response.Redirect("/_layouts/newsbweb.aspx",  false);

hope it helps :)

EDIT

SPUtility.Redirect("newsbweb.aspx", SPRedirectFlags.Static | SPRedirectFlags.RelativeToLayoutsPage | SPRedirectFlags.RelativeToLocalizedLayoutsPage, HttpContext.Current);

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.utilities.spredirectflags.aspx

That should safely redirect to the custom file within the layouts folder :)

  • thank you I have tested both, solutions, first one generates The file '/_layouts/1053/_Layouts/newsbweb.aspx' does not exist second one does not go to the page I want to. I wan to redirect to the page that is silverlight page of creating new site. – Medes Oct 2 '12 at 12:45
  • iv ammended the answer, added the wrong one for you lol, pluss i added the _layouts hence why it came out like '/_layouts/1053/_Layouts/newsbweb.aspx' ooops! – Ali Jafer Oct 2 '12 at 12:56
  • I have solved this by using _layouts/AddGallery.aspx – Medes Oct 2 '12 at 13:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.