Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Niels Lynggaard 193 posts 551 karma points
    Apr 22, 2014 @ 13:35
    Niels Lynggaard
    0

    Disable request validation

    Hi Guys

    I'm battling a rather irritating problem. We're posting some html through a form, but the handling of that form returns "potentially dangerous request" since it contains markup.

    I have tried to disable request validation in the web.config without any effect.

    I've tried the following line in the razor-script that renders the piece of xslt that actually handles the post.



    @{
      ((umbraco.UmbracoDefault)HttpContext.Current.CurrentHandler).ValidateRequest = false; }

    That results in an error; Cannot cast 'Umbraco.Web.Mvc.UmbracoMvcHandler' to type 'umbraco.UmbracoDefault'.

    I've tried doing it with a bit of c# in my actionhandler.xslt that handles the post:

       <msxml:script language="C#" implements-prefix="user">
            <![CDATA[
      void DisableRequestValidation() {
        ((umbraco.UmbracoDefault)HttpContext.Current.CurrentHandler).ValidateRequest = false;
      }
      ]]>
        </msxml:script>

     

    I've looked at this post here: http://webcache.googleusercontent.com/search?q=cache:oBdv2c0PCuIJ:eitherxor.retox-1.titaninternet.co.uk/blog/disabling-request-validation-in-umbraco/+&cd=4&hl=en&ct=clnk&gl=us

    I can't seem to get it turned off so that I can get my hands on the postet markup.

    Any hints and help is greatly appreciated!

  • Niels Lynggaard 193 posts 551 karma points
    Apr 22, 2014 @ 13:36
    Niels Lynggaard
    0

    I should propably add that I'm using Umbraco 6.1.6

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Apr 22, 2014 @ 13:43
  • Niels Lynggaard 193 posts 551 karma points
    Apr 22, 2014 @ 14:13
    Niels Lynggaard
    0

    Tried the first one with no luck.. But maybe there's something I'm not sseing.

    Tried the second one in different variations in the .cshtml file rendering the xslt-actionhandler. But that results in

    Cannot convert type 'System.Dynamic.DynamicObject' to 'umbraco.UmbracoDefault'

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies