Developer forum
E-mail notifications
Dynamicweb in .Net 4 application pool
For a new Dynamicweb solution i tried running the application pool in .Net 4 and integrated pipeline. This seems to work without problems.
My question is do you support and recommend running the Dynamicweb application in .Net 4?
The reason i ask is because the performance of website startup time under .Net 4 has significantly increased.
I had to add attribute requestValidationMode="2.0"
to the web.config element httpRuntime.
Otherwise you get an exception when saving content.
(A potentially dangerous Request.Form value was detected from the client ...)
Kind Regards,
Remi
Replies
As from version 8.0 Dynamicweb will officially support .NET runtime 4.0 but, yes, you can already switch to it if you want. There are some minor issues (mostly the backend) that we will fix before the release. If you experience any problems try switching back to 2.0 runtime.
-- Pavel
What are the "minor issues"?
Once we have developed something using .NET 4.0 we are not able to just switch back to 2.0.
It would be nice to know what breaks in DW before we choose to make use of .NET 4.0.
/Morten
I meant the runtime, not the target framework. If you're about developing something using the functionality introduced with .NET 4.0 then I'd suggest you to wait until the 8.0 comes out.
Regarding the known issues: there are some issues related to controls library. In particular, it seems that EditableGrid control can't handle new rows being added.
-- Pavel
Imar
Thanks for your reply. I will ask our QA engineers to verify and file this bug.
-- Pavel
FYI I can confirm the seo module exception on:
CountryList(Google.getCountry(True), "Country")
in Admin\Module\Seo\AnalyzePage.aspx line 180
regards,
Remi
It has already been logged. Here's what support said:
Message from our Development department regarding bug 5504.
We do not support .net 4.0 until later version. (Hopefully in fall 2011)
Therefore this case has been reprioritized as a category 2
Kind regards,
Imar
That is not good news. This means that we probably have to migrate some of our customers solutions to another CMS as we are using some third party functionality that relies on .NET 4.0 :(
Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
Haven't found a solution to this yet; I am open for suggestions in case anyone has a workaround.
Imar
Hi Imar,
Have you found a solution for the "Validation og viewstate MAC failed" error? I'm experiencing the same problems with a usercontrol. The error occurs when I click a button that just gets something from the database and set some values in a hidden field.
// René
Hi Rene,
Are you using the web.config file that ships with the main product? AFAIK, that fixed it for me....
Imar
Hi Imar,
Yes I'm using the standard DW web.config file. I don't know much about the web.config file, so what does AFAIK mean?
Btw, I think i found out why the error occurs. Let's say I have a test page with the following url: "www.testdomain.com/en-US/test.aspx?id=2"
When I load my UserControl on this page, the form tag gets an action like this: "test.aspx?id=2"
If I (via. developer tools in Chrome) change this to "/en-US/test.aspx?id=2" the form actually works. Have you tried this out? If this is the reason for the error, then it's a bug that DW should fix.
Hmm... Was searching for web.config afaik... "As far as I know"... Guess I'm still (after many years though) a newbie in internet slang ;-)
What is different in your web.config than the one from DW?
Found another workaround. You can change the action of the form with js/jQuery. You could select your form by name
$('form[name=myForm]').attr('action','<!--@Global:Pageview.Url-->');
or by id,
$('#myForm').attr('action','<!--@Global:Pageview.Url-->');
or just change all forms on the page if that's what you want to do:
$('form').attr('action','<!--@Global:Pageview.Url-->');
I didn't think that this was going to work, but it actually does.
Hi René,
Looks like a bug indeed. The client side work around shouldn't really be necessary. You may want to report this to Dynamicweb so they can look into this.
Cheers,
Imar
Hi Imar,
The client side fix is ok for me as a workaround right now, but I've contacted DynamicWeb so hopefully they will fix this in one of the next releases.
Did the problem causing the error "Validation of viewstate MAC failed" ever get resolved?
Hi Alec
Take a look at this setting:
http://msdn.microsoft.com/en-us/library/system.web.ui.page.enableviewstatemac.aspx
BR Nicolai
Hi Nicolai,
Are you suggesting to set this value to false? That's NOT a recommended setting. The MSDN docs says:
This attribute should never be set to false in a production Web site, even if the application or page does not use view state. The view state MAC helps ensure the security of other ASP.NET functions in addition to view state.
In addition, this feature will be removed in a future version of the framework.
More info:
http://stackoverflow.com/questions/14052249/is-enableviewstatemac-true-compulsory-for-viewstateencryption-in-an-asp-net-webs
http://www.troyhunt.com/2013/09/understanding-and-testing-for-view.html
Imar
The problem I'm getting is because DW is posting back to the wrong place. As Rene Poulsen identified in this forum post the language layer part of the URL is being ignored when the post attribute of the form tag is being created so the place that the control tries to post to is incorrect triggering the error message.
The error occurs because of the base href tag Dynamicweb inserts in the head. This is due to customized URLs - disable those and it Works.
Problem is, that ASP.NET 4 inserts an action with the name of the page being viewed not taking the path into consideration and posts back to /page.aspx instead of subpage/page.aspx.
You can solve this in a number of ways
- Disable viewstate mac validation
- Disable base href in management center -> Solution settings, Designs & Layout Group.
- Set the postbackurl attribute on you asp:button to "" or the current URL
- Override the action attribute of the webform in the client using JavaScript, set it to empty string or the url of the current page
We cannot as far as I've investigated, control this in a general way...
BR Nicolai
A fifth way to do this is to create a custom wrapper class extending System.Web.UI.UserControl, and then use this custom class as a base for your user controls:
using System; using System.Web.UI.HtmlControls; namespace Example.UserControls { public class UserControl : System.Web.UI.UserControl { protected override void OnPreRender(EventArgs e) { // Find any form control and set its action to the post back url foreach (var control in Controls) { if (control is HtmlForm) { var form = control as HtmlForm; form.Action = PostBackUrl; break; } } base.OnPreRender(e); } private string _PostBackUrl = null; // Allow extending classes to override the default post back url by setting it to a non-empty value protected string PostBackUrl { get { if (string.IsNullOrEmpty(_PostBackUrl)) { return Request.RawUrl; } return _PostBackUrl; } set { _PostBackUrl = value; } } } }
Now, you can just extend this user control base class and everything should work.
Best regards,
Mikkel
You must be logged in to post in the forum