Aug
27
2005
no comments | posted in Programming
Microsoft crippled IIS when they put it into XP Pro, which is a real pain in the butt for developers. This is one of the main reasons you’ll find developers using server software as a dev platform. I prefer XP Pro as it’s far more lightweight and its easier to get drivers for new technology like bluetooth etc etc.
Obviously a lot of other people have come across this problem before. There is a great utility on Code Project called IISAdmin.net, which minimizes to your system tray and allows you one-click activation / deactivation of websites. So with this gizmo and SQL developer edition, XP Pro as a standalone dev box rocks!
Aug
22
2005
no comments | posted in Programming
There is a useful control from MetaBuilders that allows you to set the default button that should receive the “event” if a user hits the enter key, based on whichever textbox has focus. If you do a google, you’ll see tons of pages about how difficult a situation this is to handle. Bull
Enter Raj Kaimal (His blog’s slogan is If it ain’t broke, make it better
– he has a +- 10 line javascript that replaces the metabuilders control, and its implementation is simpler. And it works with rewritten URLs to boot.
check it out here:
http://weblogs.asp.net/rajbk/archive/2003/12/11/43023.aspx
Note to self: bookmark this
Aug
22
2005
no comments | posted in Programming
I found that Ed Courtenay’s brief on handling postbacks wasnt as good as I had assumed. For more info on url rewriting and handling the form postback properly. see this paper on MSDN:
http://msdn.microsoft.com…urlrewriting.asp
You basically need to implement your ownhtmlform control that leaves off the action tag altogether. There is source code in this article, here’s mine:
using System;
using System.Web.UI;
using System.ComponentModel;
using System.Web.UI.HtmlControls;
namespace Cohen.Mark.Common
{
[DefaultProperty("Text"), ToolboxData("<{0}:ActionForm runat=server>{0}:ActionForm>")]
public class ActionForm : HtmlForm
{
protected override void RenderAttributes(HtmlTextWriter writer)
{
writer.WriteAttribute(“name”, this.Name);
base.Attributes.Remove(“name”);
writer.WriteAttribute(“method”, this.Method);
base.Attributes.Remove(“method”);
this.Attributes.Render(writer);
base.Attributes.Remove(“action”);
if (base.ID != null)
writer.WriteAttribute(“id”, base.ClientID);
}
private class ActionFormHtmlTextWriter : HtmlTextWriter
{
private string actionUrl;
public ActionFormHtmlTextWriter(HtmlTextWriter writer) : base(writer)
{
}
public ActionFormHtmlTextWriter(HtmlTextWriter writer, string tabString) : base(writer, tabString)
{
}
public string ActionUrl
{
get { return actionUrl; }
set { actionUrl = value; }
}
public override void WriteAttribute(string name, string value, bool fEncode)
{
if (value != null && String.Compare(name, “action”, true) == 0)
value = ActionUrl;
HtmlTextWriter writer = (HtmlTextWriter)InnerWriter;
writer.WriteAttribute(name, value, fEncode);
}
}
}
}
Aug
7
2005
no comments | posted in Programming
I came across this problem a few times… You implement a snazzy url rewriter for SEO reasons, or to make your app have friendly urls that people can write down or email easily. The next thing that you get to discover is that all your form posts break.
This is basically because the native htmlform control in .net uses the wrong url and doesn’t let you easily mess with it. It’s easy enough to implement your own url rewriter, and rather than harping on about it I’m going to point you directly to the cleanest example out there:
http://www.edcourtenay.co.uk/AdventuresInUrlRewriting.aspx