Archive for November, 2011


A breaking change in ASP.NET 4.0 causes a javascript error to be thrown on a page if a query string has a “potentially unsafe” character, such as an apostrophe in a last name.

You’ll see the error (possibly only while debugging): “A potentially dangerous Request.QueryString value was detected from the client” when passing the special character in a query string in a button click or a jqgrid’s FillGrid postData BuildGrigArgs function.

The fix is easy:  set the behavior back to ASP.NET 2.0 in the web.config with this line in the system.web section right below your </compilation> tag (the requestPathInvalidCharacters parameter here blocks everything except a single quote):

 <httpRuntime requestPathInvalidCharacters="&lt;,&gt;,*,%,:,&amp;,\" requestValidationMode="2.0" />

And in your pages be sure you don’t encode the parameter in the MVC code in your javascript (i.e. you’ll need to use <%= instead of <%: for those parameters that need special characters). 

For example, this:

    function BuildPreviousArgs() {   

            var args = new Object();

            args.FilterLastName = "<%: Model.FilterLastName %>";

            return $.param(args);

        }

Has to be changed to this:

    function BuildPreviousArgs() {   

            var args = new Object();

            args.FilterLastName = "<%= Model.FilterLastName %>";

            return $.param(args);

        }

If you want to be able to ctrl-c/v to copy-paste in Octave, ditch the Octave.exe command window and download the open source Console2 from SourceForge.

Follow Scott Hanselman’s instructions for installing Console2:

http://www.hanselman.com/blog/Console2ABetterWindowsCommandPrompt.aspx

Once you’ve installed Console2, here’s how you add an Octave window:

  1. Open Settings (right-click on the window and go to File, then Settings), then go to Tabs, and Add a new tab.
  2. Change the new tab’s title to Octave.
  3. Set the Icon to the Octave icon (e.g. the default location would be C:\Octave\3.2.4_gcc-4.4.0\bin\octave.ico).
  4. Set the Shell to the Octave exe (e.g. the default location would be C:\Octave\3.2.4_gcc-4.4.0\bin\octave-3.2.4.exe)
  5. Set the Startup dir to your homework project folder (such as C:\stanford_machine_learning\mlclass-ex1).

That’s it! Now in your Console2 window, go to File, New Tab, Octave and you’re off and running.

© 2017 Robert Corvus