Tuesday, December 8, 2009

AnkhSVN for Web Sites

AnkhSVN won't allow you do versioning control on any files or folder that are not a sub directory of your project. The problem is when you create a "New Web Site" in Visual Studio (at least in 2008) it creates your project file in the path "Visual Studio 2008\Projects\WebSite1" and your files are created in "Visual Studio 2008\WebSites\WebSite1".

The trick is to not use "New Web Site" from the File menu. You must create a project first then add your website as a sub directory of your project.

1) Create a Project (File->New Project): 2) Be sure to check "Add to Subversion" 3) Then add your web site (File->Add->New Web Site). Just make sure you make it a sub directory of your project folder.

Thursday, October 22, 2009

Client-side Spell Checking with Asp.Net and jQuery

Overview

I couldn't find a client-side spell check that worked with Asp.Net, so I decided to use Brandon Aaron's jQuery plugin, "Spell Check". He gives you an PHP file to handle the request to the Google API, but I don't use PHP on my server, so I had to create the following Asp.Net Generic Handler.

Create a Generic Handler


Copy and paste this into the Generic Handler you just created:
string text, body, lang;

lang = context.Request.QueryString["lang"];

text = HttpUtility.UrlDecode(context.Request.QueryString["text"]);

body = ""
  + ""
   + "" + text + ""
  + "";


WebClient client = new WebClient();
client.Headers.Add("Content-Type", "text/xml");

byte[] buffer = Encoding.UTF8.GetBytes(body);

byte[] response = client.UploadData("https://www.google.com/tbproxy/spell?lang=" + lang, "POST", buffer);

string result = Encoding.UTF8.GetString(response);

context.Response.ContentType = "text/xml";
context.Response.Write(result);

Change the URL

Need to change the url in the jquery.spellcheck.js file (line 44 in Version 0.2-pre):