jquery - A potentially dangerous Request.Path value was detected from the client (&) on button click -


i have redirect controller action on button click, i'm getting error

 `a potentially dangerous request.path value detected client (&).`  

here code:

views/_layout.cshtml

    <body>         <div id="wrapper">             <div id="tab1">                 <div class="tab2">                     <div id="test2" class="officebar">                         <ul>                             <li class="current"><a href="#" rel="home">main</a>                                 <ul>    // ..other button code..                           <li><span>logout</span>                             <div class="button">                              <a href="#" id="logout"  title="logout">                                                 <div class="logout">                                                 </div>                                                 logout</a>                                         </div>                                        </li></ul></li>   <script>      $("#logout").click("click", function () {                     //window.refresh("./account/logoutview");                    // "@url.action("logoutview", "account")";                     window.location = "@url.action("logoutview", "account")";                  window.location.href = "@url.action("logoutview", "account")";                  });   </script> 

this logoutview location:

views/account/logoutview 

this output error, please : enter image description here

edit3:

i can able hit action method if use

<li> <div><a class="button" href="@url.action("logoutview", "account")"  title="logout">logout</a>  </div></li> 

but need use above mentioned design .this problem.

solution:i tried window.location.href = 'account/logoutview'; instead of window.location.href = "@url.action("logoutview", "account")"; thankyou user2110309, pkkg, mmohamad bataineh time :)

try putting in web.config

<system.web>     <httpruntime requestpathinvalidcharacters="" requestvalidationmode="2.0" />     <pages validaterequest="false" /> </system.web> 

this may open risks in application if you're not escaping data. recommend replacing & sign character _ .

other that, try putting [validateinput(false)] on top of action. said not working may putting on wrong action.


Comments

Popular posts from this blog

design - Custom Styling Qt Quick Controls -

Unable to remove the www from url on https using .htaccess -