0

I have just performed an upgrade from 4 to 6 (still using WebForms) and got most things working again - but I'm unable to set the HTML form action correctly on a page with a usercontrol on a page which has a rewritten URL. The nice URL is like /developer-job-in-london-J12345 and the rewritten URL is /jobs/details.aspx?JobRef=J12345.

On v4 I just set the Request.Page.Form.Action to the Page.Request.RawUrl in the UserControl code, running the same code in v6 seems to work fine - but looking in the HTML output, it's still using the rewritten URL as the action (/jobs/details.aspx). Which means you're sent to a different URL on postback and a new entry is added in your history.

I can check Page.Form.Action and it looks correct from the control Page_Load and the master pages (actually tried all the events I could think of), but as I say, the final HTML is always incorrect.

Has something changed in v6 relating to this? Is there anything I can do to avoid having to fix this in JavaScript!? :(

New assembly version is: 1.0.5529.18434 if that matters.

Thanks!

Edit

<add name="JobRewrite" virtualUrl="(.*)-job-J(.+)$" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/Jobs/Details.aspx?JobRef=J$2" ignoreCase="true" />

Edit 2

Stranger and stranger: This was working fine on my CI server - the action is set correctly, but I have a mobile site which is just a WebForms project, with Umbraco installed so I can use the membership provider. That site appeared to have the opposite problem - there's a search form there which has a blank action on my CI server, but works fine on my dev machine.

However, I've now fixed that with help from here: https://stackoverflow.com/a/15353347/48348 - and it turns out to be a problem with changing my project to the latest version of ASP.NET - and the handling of form actions for default documents. Not sure if that can actually be related to this as it's Umbraco that should be handling everything here? Hmm...

As a slight aside: I'd love to use LESS umbraco on that site, but am struggling with that, too - question about that here: https://our.umbraco.org/forum/developers/api-questions/63161-Use-Umbraco-membership-(and-profile)-provider-in-non-Umbraco-ASPNET-web-forms-site

Community
  • 1
  • 1
Ian Grainger
  • 5,148
  • 3
  • 46
  • 72
  • I think we need to see some code. How is the url being rewritten? – wingyip Mar 13 '15 at 07:31
  • This is very strange - but on my CI server it works. So it seems like it's a localhost/IIS Express issue? It's using the Umbraco UrlRewriting module - I'll add the line from the config. – Ian Grainger Mar 13 '15 at 09:19

0 Answers0