UpdatePanel and Response.Redirect
Hello,
I'm facing a problem with this:
Most of my Response.Redirect calls inside standard <asp:UpdatePanel>
resolve unrecognizable URLs in Sitefinity.
ie:
Response.Redirect("~/MyAccount")
Result in:
localhost/...//MySitefinityWebApp/MyAccount
This is how my HTML Looks like:
<asp:UpdatePanel ID="udpErrorMessages" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">
<ContentTemplate>
<!-- ANY CONTENT HERE -->
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnValidate" />
</Triggers>
</asp:UpdatePanel>
The btnValidate executes the Response.Redirect.
If I Quick-watch the ResolveUrl("~/MyAccount") just before the execution I looks normal but the Response.Redirect("~/MyAccount") mess things up.
PS: I'm not using telerik controls and in a Asp.Net App outside Sitefinity this is not an issue.
Any help will be appreciated.
Might be completely wrong, but I remember using something like
Response.Redirect(Server.MapPath("~/whatever"));
Thanks Andrei ,
Same issue the URL now looks more scrambled.
Looks more like an internal problem in the Redirect no matter what I send a hard-coded url:
Response.Redirect("~/MyAccount")
The address bar in the browser shows:
localhost/...//MySitefinityWebApp/MyAccount
Again only in code behind executed from a <asp:UpdatePanel>
I read a post that suggest using RadAJaxManager.Redirect instead of regular ASP Response.Redirect.
But that force me to change all regular panels and managers to Rad controls.
www.sitefinity.com/.../response-redirect-url-problem.aspx
have you seen this: forums.asp.net/.../1
I use buttons extensively in my Sitefinity project, but i assign the PostBackUrl (this.aspButton.PostBackUrl = "";) and work that way. Below is a code example of how I use it, which might not help at all.
public partial class AspButton : System.Web.UI.UserControl
private FluentSitefinity fluent = App.WorkWith();
private Guid _selectedPage;
public Guid SelectedPage
get
if (this._selectedPage == null)
return Guid.Empty;
return this._selectedPage;
set this._selectedPage = value;
public string SelectedPageTitle
get
if (this.SelectedPage == null || this.SelectedPage == Guid.Empty)
return String.Empty;
return fluent.Page(this.SelectedPage).Get().Title;
protected void Page_Load(object sender, EventArgs e)
//load the post back url
if (this.SelectedPage != Guid.Empty)
try
this.aspButton.PostBackUrl = fluent.Page(this.SelectedPage).Get().GetFullUrl();
catch
this.aspButton.PostBackUrl = "";
Not a solution but thanks a lot..
I'm creating a support ticket instead. Is very simple and easy to replicate. I don't think I'm doing something wrong but in standard ASP Net the issue is not present.
I was trying to attach the entire sitefinity project so anyone could replicate the issue..but due to the 2 mb limit is impossible.
Thanks again.
Ok sorry Ronny. I know thet in the past I had to be careful about defining Page.IsPostback() or this.IsPostback(). Telerik are quite helpful when it comes to tickets, so good luck.
Telerik,
I'm having the same problem with Response.Redirect and I'm also in an asp:UpdatePanel. This code works just fine in a standard aspx page, but doesn't work from within Sitefinity. I've tried the following in my code-behind:
Response.Redirect(~/thankyou, true);
Response.Redirect(/thankyou, true);
In either case the rendered url is http://testserver.com/account/%2fThankYou. My first question is why isn't the url rendered as root relative? I've tried encoding the url in the code-behind as well which has no effect.
Our shop is running Sitefinity 4.2.1650
Thank you.
Mark
Mark,
I did some searching and it seems you're not alone. Adding the following section to your web.config may solve your issue.
<
httpModules
>
<
add
name
=
"ScriptModule"
type
=
"System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
/>
</
httpModules
>
Hello Tim,
Thanks for the interest .. Yes, Actually the solutions came from Sitefinity team...and works perfectly for 4.2..
I'm pasting it. this can be helpful to anyone running the same issue..
<"Hi Ronny,
The problem is that Sitefinity uses outdated scripts in some cases.
If you need to call the Response.Redirect in your update panel you will
have to make a small change in your configuration. Navigate to
Administration -> Settings -> Advanced. In the left panel navigate
to the following nodes Pages -> Script Manager -> Script
References -> MicrosoftAjaxWebForms. Look at the main area. Change
the Name field from "Telerik.Sitefinity.Resources.Scripts.MicrosoftAjaxWebForms.js" to "MicrosoftAjaxWebForms.js" and theAssembly field
from "Telerik.Sitefinity.Resources" to "System.Web.Extensions" and
press the "Save changes" button. You can also look at the attached
image.
http://www.sitefinity.com/ClientsFiles/246191_settings.jpg
After this change, you will be able to use your redirects inside the UpdatePanel.
Thanks. That fixed the issue.
Mark
Just got bit by this one and it ended up costing me a couple of hours before I stumbled on this post. Thanks for posting the fix.
--Steve
Thanks for posting this!
This issue is still alive and well in SF 4.3, but only when logged in as an administrator. When using the site anonymously or as a basic user, everything worked fine. Once logged in as an admin, all the urls got corrupted as described above. The above solution fixed the issue.
Sure, you're welcome,
Great to know the solution is still valid..
(the attached image is no longer available but hope instructions are clear).
Actually we are in 4.4 now and as a rule we change the script reference resources from telerik's to microsoft's.
I am using sitefinity 3.7 and have the same issue. Does the same fix work for 3.7
Thanks,
Priya
I am using sitefinity 3.7 and have the same issue. Does the same fix work for 3.7
Thanks,
Priya
it works for me, thanks.
Hi I had same issue and was breaking my head, I had a custom login control and was trying to implement secure pages on multi site solution, Once user clicked to secure page, it was being redirected to login page, though from their it was always trying to redirect to eg>
Click on "Contact Us" (a secure page)
The link is: mytestsite.com/.../login
Login and
Site breaks as it goes to mytestsite.com/...//1/contact-us
This solution worked for me:
The problem is that Sitefinity uses outdated scripts in some cases.
If you need to call the Response.Redirect in your update panel you will
have to make a small change in your configuration. Navigate to
Administration -> Settings -> Advanced. In the left panel navigate
to the following nodes Pages -> Script Manager -> Script
References -> MicrosoftAjaxWebForms. Look at the main area. Change
the Name field from "Telerik.Sitefinity.Resources.Scripts.MicrosoftAjaxWebForms.js" to "MicrosoftAjaxWebForms.js" and theAssembly field
from "Telerik.Sitefinity.Resources" to "System.Web.Extensions" and
press the "Save changes" button. You can also look at the attached
image.
http://www.sitefinity.com/ClientsFiles/246191_settings.jpg
After this change, you will be able to use your redirects inside the UpdatePanel.
I am experiencing similar issues response.redirect not working inside an update panel. Changing the web.config file didnt work in my end. I am using vs2010 and can't find Administration menu. Please help !!!
http://www.sitefinity.com/ClientsFiles/246191_settings.jpg
After this change, you will be able to use your redirects inside the UpdatePanel.