Notes from Daily Encounters with Technology RSS 2.0
 
# Tuesday, September 19, 2006

Don’t use Configuration.Save in scenarios where users might only have read and write permissions for the configuration file as UnauthorizedAccessException will be thrown if full control is not granted. More details are available in the following MSDN Forum posting.

Tuesday, September 19, 2006 11:32:34 PM (Central European Daylight Time, UTC+02:00)  #    Comments [0] - Trackback
Development | .NET
# Sunday, September 17, 2006

ASP.NET offers several ways of mapping nice public URLs to cryptic internal URLs matching the actual implementation.

The simplest way is to match each public URL to its internal value. You can do this by either creating dummy pages which do the redirecting or by adding them to the urlMappings section of the web.config file (brought by framework 2.0). The latter solution is preferable because of simpler maintenance but both of them have the downside of being completely static (an entry is necessary for each mapped page).

A better solution is to implement an IHttpHandler or IHttpModule and do the mapping by calling HttpContext.RewritePath(). You could also change the requested page by using Server.Transfer() or maybe even Response.Redirect() but they have their disadvantages when used for URL mapping.

To avoid having to recompile your IHttpHandler implementation every time the mapping logic changes or extends you could configure it through a custom section in the web.config file. Regular expressions are a nice tool for defining such mappings as demonstrated by here (also check the comments) or implemented in dasBlog sources (check newtelligence.DasBlog.Web.Core.UrlMapperModule). You could even use UrlRewritingNet.UrlRewrite if you don’t like reinventing the wheel.

Sunday, September 17, 2006 1:33:22 PM (Central European Daylight Time, UTC+02:00)  #    Comments [0] - Trackback
Development | ASP.NET
# Thursday, September 07, 2006

The following code returns the time when a web resource was last modified:

static DateTime GetModificationTime(string url)
{
   WebRequest request = WebRequest.Create(url);
   HttpWebResponse response = (HttpWebResponse) request.GetResponse();
   DateTime lastModified = response.LastModified;
   response.Close();
   return lastModified;
}

It’s quite a simple piece of code actually and very similar to a sample in MSDN. But maybe it will be useful to someone since a member of my developer team was convinced that there is just no way to get this information in .NET.

Thursday, September 07, 2006 11:41:34 PM (Central European Daylight Time, UTC+02:00)  #    Comments [1] - Trackback
Development | .NET
# Saturday, August 05, 2006

Although in Visual Basic 6 all string variables are inherently Unicode, the same is not true for the components that come with it – they aren’t capable of displaying (or accepting input of, for that matter) Unicode characters. The same goes for most of the popular third party ActiveX controls that are available on the market.

Unless you’re deciding to move the form (or even the complete application) to .NET, the best solution is to use the components from the Microsoft Forms 2.0 Object Library. There are a few downsides though:

  • They come with Microsoft Office and aren’t freely redistributable. But even if your clients don’t have Microsoft Office, they can legally obtain the components by installing the free Microsoft ActiveX Control Pad which contains them.
  • The use of these components outside Microsoft Office isn’t officially supported. Still this shouldn’t be a problem as long as everything works. After all, even Microsoft recommends using these components in such a situation.
  • The set of the components is not really complete and it might not be enough if you have a bit more complex needs. In this case there’s still UniToolbox available. I haven’t tried it but it looks a promising collection of Unicode components for Visual Basic 6. Might be worth a look.
Saturday, August 05, 2006 2:57:00 PM (Central European Daylight Time, UTC+02:00)  #    Comments [0] - Trackback
Development | VB6

Once the number of projects in a solution comes up to thirty or more, most of the project related operations become really slow: setting the default project, building a project starting and stopping a debug session etc. There are no noticeable slowdowns with up to twenty projects in a solution though.

Although usually no solution with real projects should reach such numbers (I stumbled upon it by just adding sample projects to the same solution), it is something to have in mind when deciding how to group projects in solutions.

Saturday, August 05, 2006 2:16:42 PM (Central European Daylight Time, UTC+02:00)  #    Comments [0] - Trackback
.NET | Software | VisualStudio
Sponsored Ads

About Me

Damir Arh

Microsoft Certified Professional

View Damir Arh's profile on LinkedIn

Profile for ExAmigan

ExAmigan

Twitter
Damir's Corner: Avoiding Queue Starvation in CruiseControl.NET http://goo.gl/fb/G52YB 1 day ago
RT @aleksj: From http://last.fm/robots.txt: Disallow: /harming/humans, Disallow: /ignoring/human/orders, Disallow: /harm/to/self #asimov 2 days ago
Eagle Eye on DVD was a pleasant surprise. It passed under my radar when it was first released. 5 days ago
Multiple RTM gadgets in iGoogle suddenly can't show different lists anymore http://digs.by/aD5AbJ 6 days ago
Notifications for new projects in CCTray are a nice new feature of #ccnet 1.5 7 days ago
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

All Content © 2010, Damir Arh, M. Sc. Send mail to the author(s) - Privacy Policy - Sign In
Based on DasBlog theme 'Business' created by Christoph De Baene (delarou)