Well, you can't do it in C#, per se, since this runs on the server. You can,
but this will break if your client doesn't have you in a zone where scripts
are enabled, so make sure you use a noscript tag to catch this and give some
feedback to the user as to why your site isn't working as expected.
Microsoft MVP - Windows XP
Windows XP Associate Expert