Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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, ???)
share|improve this question
    
SPUtility.Redirect("~site/_layouts/newsbweb.aspx", SPRedirectFlags.Trusted, HttpContext.Current); –  Daniel Ziga Oct 2 '12 at 12:31
add comment

1 Answer 1

up vote 1 down vote accepted

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 :)

share|improve this answer
    
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 Sharepoint Oct 2 '12 at 12:56
    
I have solved this by using _layouts/AddGallery.aspx –  Medes Oct 2 '12 at 13:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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