2006-02-15

Request.ServerVariables("HTTP_REFERER") - What is going on?

NIS by default blocks the header "HTTP_REFERER" to be sent from the browser to the server. If your web application is depending on this servervariable, and your clients are using NIS, then do the following:

NIS:
- Privacy control - configure
- Advanced button
- Global settings tab
- "Information about visited sites"

If blocked (this appears to be the default) then HTTP-REFERER is wiped out. Change this option to allow the header to be sent.

2006-02-10

.NET Tools: Ten Must-Have Tools Every Developer Should Download Now -- MSDN Magazine, July 2004

You cannot expect to build a first-class application unless you use the best available tools. Besides well-known tools such as Visual Studio® .NET, there are a multitude of small, lesser-known tools available from the .NET community. In this article, James Avery describes some of the best free tools available today that target .NET development.

2006-02-06

FuzzyEnumParse

This function takes an Enum type and a text representing the value of the enum, and if the Enum has a field with a name contained in the text (enumText), then it returns that value.

For use when for instance the database field to parse from has been extended somewhat... Modify to suit your needs!


private object FuzzyEnumParse(System.Type type, string enumText)
{
System.Reflection.FieldInfo[] fis = type.GetFields();
foreach(System.Reflection.FieldInfo fi in fis)
{
if(fi.Name!="value__")
{
object obj=fi.GetValue(null);
if(enumText.IndexOf(obj.ToString())>-1)
{
return obj;
}
}
}
return null;
}

2006-02-01

Serialising doesn't work for read-only properties in webservices

I have been puzzled by the behavior of my webservice. I have a couple of properties in an object that is sent as a parameter to the webservice. Since these properties are not assigned directly by any code, I didn't implement a "set" method for the properies. (As it turns out: Bad mistake!)

What happened was that the values were set in the client to "true", but when the object arrived inside the webservice, the values were suddenly "false".

It turns out, if you don't implement both "get" and "set" for a property, it will not be serialised.