Friday, March 2, 2012

allow for the passing of HTML in form fields with ASP.NET MVC projects

This post I found suggests putting this in the system.web section of a Web.config file:

<httpRuntime requestValidationMode="2.0"/>

 
 

...in the name of allowing one to send HTML in form fields in C# 4.0 MVC projects. That said, you will still also need to color methods which return ActionResults that would process such requests with:

[ValidateInput(false)]

JsonRequestBehavior.AllowGet

http://forums.asp.net/t/1483387.aspx explains that in order to allow GET Json requests in MVC 2 or greater that one needs to add JsonRequestBehavior.AllowGet to Action calls like so:

return Json(new { isAdmin = isVerifiedAdministrator() }, JsonRequestBehavior.AllowGet);

SQL Server Express Local Connection String

server=.\sqlexpress;database=NAMEOFYOURDATABASE;Integrated Security=true;

read from the App_Data folder

AttachDBFilename=|DataDirectory|Whatever.MDF is the bit of a connection string that will allow for reading a .MDF in the App_Data folder.

Thursday, March 1, 2012

localStorage

This posting suggests that one may interface with HTML localStorage like so via jQuery:

localStorage.setItem("name", "Hello World!");

document.write(localStorage.getItem("name"));

localStorage.removeItem("name");

 
 

I went to the geek lunch today and part of the conversation at my table had to do with localStorage. One may keep cookies in localStorage and one may rely on localStorage in the event of a loss of connectivity in an SOAesque failover sort of way.

a nonclustered index in MSSQL

I took the SQL I wrote here and put a nonclustered index (an index that does NOT require unique values) on the Name column in the Person table like so:

CREATE NONCLUSTERED INDEX myindex ON [Person] ( [Name] ASC ) ON [PRIMARY]

 
 

I could then use it like so:

SELECT * FROM Person WITH (INDEX (myindex))

 
 

I could eventually wash my hands of it like this:

DROP INDEX myindex ON [Person]

 
 

Some helpful links: