SharePoint Sandbox Solution - Page Redirect
A sandbox solution cannot call Response.Redirect, so write a small script through a literal control instead.
Redirecting to another page from a sandbox solution is awkward, because the usual server side redirect is not available. A workaround is to let the web part write a client side redirect.
Add a literal control to the web part:
html
<asp:Literal ID="litRedirect" runat="server" />
Then, from the code behind, set its text to a script that changes the window location:
csharp
litRedirect.Text = "<script type='text/javascript'>window.location = 'https://example.com/';</script>";
Scenario
- A sandbox web part saves a form.
- After the save succeeds, the code behind sets
litRedirect.Text. - The browser runs the script and moves to the thank you page.