Allowing HTML submittal in a 4.0 world

Just ran across this and thought I’d pass it along. Ever needed to allow html to be submitted as a part of an ASP.NET form? You go to test it and low and behold you get an error message stating that it is a “Potentially dangerous script…” You yell DOH!! Slap your head and go to the page declaration to add [ValidateRequest=”False”]. No problemmo. Bob’s your uncle, fanny’s your aunt, and all’s well with the world.

But wait. You’re living in .NET 4.0 now. Your still getting the error message. How can this be? Well in .NET 4.0 you need to do a little extra. IT seems they REALLY don’t want you to do this. So you have two choices.

` Add JavaScript to intercept the string before it is sent, Html encode it, and THEN send it to the server. Oh and don’t fore get to reverse the process whenever you need that data.

` Add the following extra tag to the section of your web.config file to tell .net that its ok.

` * <httpRuntime requestValidationMode=”2.0” />

The new error message gives you this info if you read it closely, but since it was a known error I didn’t look closely at it until I had found the fix online. For those who want more technical information here is a link to the article I found.

.NET, SharePoint and Eclipse? Oh my!

Earlier today someone asked me if it was feasible to do SharePoint development in Eclipse. So while my first thought was, “Are you f’n kidding me?” I decided to do a little looking around as I’m always interested in finding a way to do more .NET development on my Mac.

So here is my ultimate response to the question.

Short Answer: No. It is not feasible to do SharePoint development in Eclipse.

Long Answer: I could probably come up with a methodology to utilize eclipse (Assuming Java), to write some customizations that would interact with SharePoint web services, but it would never be truly integrated. Customizations might be in the form if an iframe out to a java page, or perhaps a java plugin embedded into an html/aspx page. I’ve done something similar with flash in the past. In fact if you really want to go down this road you’d probably be better off writing controls in flash, than Java, since you’d at least get a rich UI out of it. Of course with both tracks you’d probably spend more money in extra development time trying to get it all to work the way they wanted, than to just pay for a couple of VS licenses.

Now if you’re talking about using eclipse to develop some ajax functionality, that’s a little different. You’d still end up needing a tool like SharePoint Designer (SPD) to get the code into SharePoint (Though you could probably make due with just uploading the pages if it’s a publishing site). Eclipse might be a good ide to get the functionality working as a prototype. I sometimes use Coda the same way on the mac.

Now if you’re thinking about using a C# plug-in for eclipse, there’s no point. Even with all of the features that Visual Studio Express (The free version of Visual Studio) is missing it can still do more than any of the plug-ins I found for eclipse. You’ll also have no issues getting express for the latest version of Visual Studio. With plug-ins you normally have quite a bit of lag from the time a new version of Visual Studio comes out. And oh, did I mention that it’s free? Some of the plug-ins for eclipse cost money and the ones that don’t just seem to do syntax highlighting, and activate the compiler via a command line call. I can get that with Notepad++ (Also free).

Hope this helps any of you who might be curios about the same thing. I’m still looking for a good way to code .NET on the Mac. So far the best I’ve come up with are syntax highlighters since I’m usually dealing with versions too current for projects like Mono, but that’s better than nothing.

UPDATE 11/5/2011:

I’ve been using MonoDevelop off and on for a while, and while I like it, the issue I keep coming back to is that it will always be out of date. For example I like to do all of my web development using the Razor syntax in MVC 3. While Mono can execute MVC 3 and Razor code compiled from windows, the MonoDevelop tool cannot deal with Razor. (MVC 3 with asp.net seems to work fine.) This means that, for me at least, I still default to opening up a virtual machine for .Net development.