Sunday, November 18, 2007

Sunday, November 11, 2007

Custom configuration section in 2.0

My next proof of concept is to build a custom URLMapping. The URLMapping that comes with does allow us to map based on regular expression or custom logic.

For eg. If I want to map a url http:/// to
say I have an url but internally I have overview.aspx for each country - you would like to configure and want to rewrite the url as if the user come from Japan.

To build this first I need to build a custom config section handler and then a http context module or HttpHandler Factory to handle the mapping and do necessary action.

Thought of blogging a few concepts which were related to my POC before blogging about my POC itself. Below section covers how to write a custom configuration section handler in .net 2.0. For my POC, I had to include a custom config section. Something similar to below

<urlMappings enabled="true">
<urlMapping url="^/urlmapping/lp/(.*)/(.*).aspx" mappedUrl="~/urlmapping/lp/$2.aspx?ct=$1&ln=$2" isHandlerMapped="false" />
<urlMapping url=".*/module/(.*)/default.aspx" mappedUrl="~/$1/default.aspx" isHandlerMapped="false" />
<urlMapping url=".*/seo/(.*)/default.aspx" isHandlerMapped="true" mappedType="Town.Www.Sp.Controller.SEOHandler, Town.Www.Sp"/>

So, I had to write a custom config handler. It is pretty straight forward in .net 2.0

In our case, we have three things to worry. One is newly added configuration section, second the new Element Collection (in our case it is <urlMappings>) and finally each element in the collection (in our case it is <urlMapping>). Below are the list of class we must inherit from and give our custom implementation
  • System.Configuration.ConfigurationSection
  • System.Configuration.ConfigurationElement
  • System.Configuration.ConfigurationElementCollection
Below is the complete code snippet.
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports System.Configuration

Namespace Configuration
''' @Author: Praveen
''' @Date created: 11/10/2007
''' Intention of this class to handle the custom config section that conceptually
''' implement the URLMapping config section in ASP.Net 2.0 but support regular expression

Public NotInheritable Class UrlMappingConfigurationSection
: Inherits System.Configuration.ConfigurationSection

Public Property IsEnabled() As Boolean
Return CBool(Me("enabled"))
End Get

Set(ByVal value As Boolean)
Me("enabled") = value
End Set
End Property

Public ReadOnly Property CustomUrlMappings() As UrlMappingCollection
Return CType(MyBase.Item("urlMappings"), UrlMappingCollection)
End Get
End Property

Public NotInheritable Class UrlMapping
: Inherits System.Configuration.ConfigurationElement

Public Property Url() As String
Return CStr(Me("url"))
End Get
Set(ByVal value As String)
Me("url") = value
End Set
End Property

Public Property MappedUrl() As String
Return CStr(Me("mappedUrl"))
End Get

Set(ByVal value As String)
Me("mappedUrl") = value
End Set
End Property

Public Property IsHandlerMapped() As Boolean
Return CBool(Me("isHandlerMapped"))
End Get

Set(ByVal value As Boolean)
Me("isHandlerMapped") = value
End Set
End Property

Public Property MappedType() As String
Return CStr(Me("mappedType"))
End Get

Set(ByVal value As String)
Me("mappedType") = value
End Set
End Property

Public Property IsEnabled() As Boolean
Return CBool(Me("enabled"))
End Get

Set(ByVal value As Boolean)
Me("enabled") = value
End Set
End Property

End Class

Public NotInheritable Class UrlMappingCollection
: Inherits System.Configuration.ConfigurationElementCollection
Protected Overloads Overrides Function CreateNewElement() As ConfigurationElement
Return New UrlMapping()
End Function

Protected Overrides Function GetElementKey(ByVal element As ConfigurationElement) As Object
Return (CType(element, UrlMapping)).Url
End Function

Public Overrides ReadOnly Property CollectionType() As ConfigurationElementCollectionType
Return ConfigurationElementCollectionType.BasicMap
End Get
End Property

Protected Overrides ReadOnly Property ElementName() As String
Return "urlMapping"
End Get
End Property
End Class

End Class

End Namespace
My next part would be read the web.config custom section and handle them appropriate for specific business rule

Monday, October 22, 2007

Fiddler - A proxy server

I use fiddler extensively to understand the behavior of the page. It is an excellent tool and I have been using for long time. But all along I was of the opinion that the fiddler works only with IE.

But truth is that it can work for any browser. Yes, it is not just an plug-in for IE though it is easy to get it work along with IE. Fiddler is proxy server listen at So, if you configure the proxy server for your browser to point to IP and port, you should be able to use fiddler with any browser.

Thursday, October 04, 2007

IIS 7.0 and .Net

IIS 7 is pretty friendly with .Net. Previously, to interface with IIS, we need to depend on the C++ API to leverage or extend the features of IIS. With IIS 7.0 we can talk with IIS with the language we are familiar with - that is .net API for IIS 7.0. We would be able to write ISAPI filter and extension in .net using our known VS2005 editor. Isn't that pretty cool!

Session_OnEnd does not fire after SP2 installation

Last few days our servers had big problem - Session End event was not working. We were breaking our head on this why the heck does this happen. Finally realized that recently we updated the SP2 for Window Server 2003 and this had a bug which caused the session end event not fire. We installed the patch from Microsoft it works now. Not strange from Microsoft though!;EN-US;934903

Tuesday, October 02, 2007

Marker Interface

In the world of java, it is a common approach to have something called Marker interface. These interface itself will not have any methods defined but marks the class which implements it as the special type.

E.g Serializable interface, just marks the class that it can be Serialized. But when it comes to exact serialization java depends on the naming convention though. Also we can mark a class as Singleton class using this technique. However, in the .Net world. it can be better managed using Attribute programming.

Tuesday, September 25, 2007

Sabeer Bhatia back with

With growing number of community list like Orkut, Facebook, Simpler version of e-learning community@Englishtown now Sabeer is venturing in to same arena. He has come up with his version of online social utility - ApnaCircle. He has different kind of marketing strategy though - like accumulating points as you spend time on his website and you redeem your points in exchange of some gift.

But on the whole, web seem to driven to unify bunch of users around the world .. good or bad... but really has shrunken the world and broadened the human mind.

Sunday, September 16, 2007

Photography - Rule of Thirds

I have lot of interest on photography. I love taking picture and watching others picture. At one point, when I did not have a digital camera, it was quite an expensive interest to hold upon. Now that I have a digital camera, now that I can shoot anything I feel like and play around the picture with some photo enhancing software. I got a pretty decent camera in my mobile as well. I have published my pictures at

I love my Camera too. Canon S1 IS with 10x optical zoom. Pretty nice camera for amateur which I bought some 3 years back. It is a well designed camera and fits nicely in my hand and give nice balance. Very effective IS (Image stabilization) as well is very handy when you start using 10x zoom. Only thing it lacks is, now it is 3 MP (Megapixel). It would have been better if I had a 6MP+

However, getting back to the topic. I thought I will take my photography more serious that before and wanted to learn about photography. I did some googling and read some blogs in flickr. Many people talk about one concept a lot. It was “composition” of the picture. It is nothing but identifying your subject and draw the attention of the audience towards the subject. It could be by placing the subject at different location of the photo or blurring the background and appropriately focusing the subject. There is guidance available for us and it is called “rule of thirds” handy. It has been followed for centuries now.

By this rule, if we divide the picture in to 3 vertical and horizontal portion, just like tic-tac-toe -2 lines drawn at equal spacing between them horizontal and vertical – these drawn lines form intersections. They form 4 intersections on your picture. The rule says the subject should lie on the intersections of these lines. Very interesting and gives an easy rule to follow for beginners.

Sunday, September 09, 2007

Proof of concept - Be careful with Environment!

At work, one of my colleague was suggesting using URLMapping available in .net 2.0. So thought will try something and play around with that. It is pretty simple implementation available ready made though we can think of building something to support wildcard or regular expression. Many out there have already built and kept in place - available as free and commercial version.

First, I was trying to build a POC for a URL Mapping feature in .net 2.0.

So, I had the below config in the web.config.

<urlmappings enabled="true">
<add url="~/application/action/view/test" mappedurl="~/app/navigate.ashx?action=view&module=test">
<add url="~/application/enroll" mappedurl="~/default.aspx?action=enroll">
<add url="~/application/register" mappedurl="~/app/navigate.ashx?action=register">

The above stuff worked beautifully when I ran from the VS.Net 2005 editor. The application was running in the Web Dev server. For "http://localhost:2401/application/enroll" it mapped the request to default.aspx. I moved the application to IIS 6.0. Booomm!!! I get 404 error with the http://localhost/urlmapping/application/enroll. Makes sense, because when I try http://localhost:2401/application/enroll, IIS tries to find the default document - ah now IIS could not find any default document, it throws 404 exception.

<urlmappings enabled="true">
<add url="~/application/enroll/<anything>.aspx" mappedurl="~/default.aspx?action=enroll">

When above change was made, it worked fine because, IIS has no roll to play except to hand over the request to ASP.Net engine. Once it comes to environment we have complete control. So it was important to keep proper environment for POC. As you all know Web Dev server runs with a higher privilege that IIS might actually run and this would also cause problem.

In my case it was not that costly but otherwise we should give due respect to the POC environment.

HTTPHandler Vs HTTPModule

Other day,at work, we were discussing about building a Business Interceptor. Idea is to build centralized component to intercept all web request and associate them to a Business component and pass it on to handler to do the further request processing. Approach something we inherited from Struts approach and FrontController kind of approach. Nice FrontController Article

So we had a discussion when to choose between Handler vs Module. This is my opinion, might be wrong. Before that, a quick briefing about module and handler.

Handler as it say handles request - which would mean take a request and return a response. Handler is the end point of the request chain. Module pipes the request - it can read the request, modify the request, but ultimately is not responsible for handling request but pipe that to another module or finally hand it over to handler. And importantly, the module is for every request whereas handler has other attributes affect like the extension, the verb we are looking.

Some of the decision we made is that we don't want any custom extension or different extension like ".ashx" though it is practice is java world. They for e.g. attach ".do" for struts environment.

With above understanding, the interceptor we are building is clearly a module.
Every request will be intercepted and first will be validate to see if they have any special business logic mapped and will be handle appropriately and will be piped through other module and finally handed over to custom handler or asp default handler. And in case no business logic, just follows the standard pipeline and finally handed over to the handler.

In another scenario, we wrote an HTTPHandler to read image from db and write to response as binary. So in this case, it takes the parameters reads the BLOB from DB and write to response stream and request ends with a response back to the user.

Sunday, August 26, 2007

Substitute Control

.Net 2.0 has come with bunch of new controls. Many of the controls looks like composite control of existing 1.1 control or enhanced 1.1 controls - basically after studying the market or taking look at the open source framework etc.

Substitute control is one of the new control in the stack. As we all know, the caching has been very significant concept in the web. Caching itself is a very broad topic. Caching can be done at various level - like browser side, proxy caching, server caching, database caching, kernal caching, page caching, control caching,application level, etc.

It is possible to cache page content using output cache directive. So in such case if you want a portion of the site not to come from cache but be processed all the time, then Substitute control is handy.

Friday, August 24, 2007

NGen Optimization

We all know ::: > .Net Languages > Compiled > MSIL > Compiled to Native machine code (JIT)

Ngen is an utility from Microsoft that let you precompile the MSIL code for the native platform code. This way the JIT processing is by passed and code performance quicker. But always this may not be right.

There are couple of things - one is code compilation to native code and other one compiling and code optimization. JIT is smarter than just the compilation portion. JIT does lots of runtime optimization depending upon the memory, CPU architecture, etc. Basically, JIT adjust itself to the current runtime. So before we jump and start believe that NGen is going to benefit us, it is better we do our home work.

Friday, August 10, 2007

Drupal set up - see it running!

I have not worked with PHP before nor Drupal.

But there was project running in my company in Drupal. I have been hearing about this project a lot and it was so interesting for me to listen to their work like running Apache, PHP and MySQL.

Excitement is the platform. For last few years, I have been completely in to Microsoft platform, this open source stack really excited me. Before I was working in MS platform, I had oppurtunity to work in Java, PostGreSQL and other non-MS stuff and so thought would try once again.

I have tried to briefly describe about how to set up drupal quickly.

Setting up Drupal: (All these links may go invalid later, but visit each of their site, it is easy to find the download)
1. Download drupal
2. Download PHP, say 5:
3. Download Apache
4. Download MySQL. Download "mysql-essential"

Step1: Install Apache.
Pretty straight forward, the wizard will guide you. You can register Apache as windows service. Command to register Apache as service
"httpd.exe -k install -n "

Edit httpd.conf: Configure the default document.

DirectoryIndex index.html
DirectoryIndex index.php

Step2: Install MySQL.
Pretty straight forward as well. Follow the Wizard.

Step3: Install PHP
Extract PHP zip to a convenient location, say c:\php. Add c:\php to PATH variable. Hook php to Apache. Edit httpd.conf and add these lines
#PHP Configuration#Begin
# For PHP 5 do something like this:

LoadModule php5_module "c:/php/php5apache2_2.dll"
AddType application/x-httpd-php .php
# configure the path to php.ini

PHPIniDir "C:/php"
#End PHP Configuration

Step4: Configure PHP to use MySQL
If you are using PHP 5+, MySQL is not enabled by default. To enable SQL, edit php.ini. First modify the extension directory and set to
extension_dir = "c:\php\ext"
Enable the Mysqli extension

Step5: Creating database for drupal and make note of the database, username and password

Step6: Extract the drupal download to somewhere under Apache installation. Edit the httpd.conf of apache to point to the drupal directory. Eg.
DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/drupal"

Make sure MySQL is running and Apache is running as well.

Now it is time to install the drupal. Type http://localhost:8080/ (*Assuming apache running at 8080). This should show you the Database configuration page. Enter the database, username and password, rest is taken care. It creates default tables and data and finally shows up the drupal administration page. Wow!!! I may not be totally correct. But this is what I did and it worked :). There is guy who has gone deep in to drupal, I shall discuss with him and put more info here.

SPOIL yourself!

SPOIL = Stored Procedure Object Interface Layer.

There has been many attempt by Microsoft and others to reduce the work of the developer and emphasis the concept of Rapid Application Development. I guess the intention is lesser you let the developer to code, lesser is the bug count.

SPOIL helps us to build a object oriented layer over database. Idea is that developer might never have to write ADO.Net to interact with their database. Say the stored procedure will become a object and will be strongly .net typed, thus reducing the coding effort and runtime errors. So, application would setting the values of the SP by properties.

Without SPOIL, it would be like shifting from the OO paradigm to functional, to call the SP and handle the output. It would involve writing length and error prone code.

But this did not really catch the attention of industry.

Enable default document in Apache!

This is simple stuff to write and do but when you start something new, it is always interesting. In IIS, we can enable default document. This would mean if someone hit the url like http://localhost/test/sample/ without specifying the actual page they are shooting at, the IIS must be able to return a default page. So you can configure that easily in IIS using Inet Manager.

To do the equivalent in Apache it is, we need to add the below line in the httpd.conf

## DirectoryIndex: sets the file that Apache will serve if a directory# is requested.


DirectoryIndex index.html

DirectoryIndex index.php

Thursday, August 09, 2007

Kill the beep!!

I was working with MySQL other day in my laptop. Whenever I make a mistake with query I get a beep sound which is pretty loud. So, instead of learning the correct syntax, I was thinking if I can stop this annoying noise.

This beep sound is created by ASCII BELL (character 7). To kill the the beep do a 'net stop beep' at the command line in Windows. :)

Thursday, July 26, 2007

Keep your session id secured!

Last week, we received an email from one of the website partner that our website has SessionID vulnerability. They titled the issue as “Web Server Predictable Session ID Vulnerability”

There is company that can run free security scan on a website and give a detailed report.

Back to topic, so what does that mean? There are few reasons why this kind of issue may be reported. One could, the pattern in which the webserver generates SessionID is predictable. It is not randomized enough. Or it could be because the state management technique, say may be query string or cookie that holds the information. Usually the identifiers in some of the application are identity column. For attackers this way they can predict session state and hack in to others session. Or could be the server issues same session id for HTTP and HTTPS portion of the website. It becomes for someone to impersonate SSL session with a webserver using the non-SSL session id and hack in to someone’s session.

Regarding randomizing the session id, it is more like a webserver fix. This was an known issue with some of the old J2ee based Webserver. However, there are easier fix. IIS session ID random enough.

Building session context using memberId is not advisable technique. If we are using query string, it is advisable to use Encrypted key or GUiD kind of approach. If we are building solution based on Cookie, it makes sense to hash and encrypting cookie so they are secured.

I am not sure about the scope of this issue, in the sense, is it an issue with IIS or other web servers too. But in IIS4 and IIS5, this was considered as bug and there were patches to fix them. In IIS6 we have better way of managing this. You can toggle separate session id for the SSL portion of the website. The granularity can be managed at say whole website or for a given virtual directory or given application.

adsutil set w3svc/1/AspKeepSessionIDSecure 1 >>> This will turn on secured session id for SSL

Saturday, June 02, 2007

Trigger - An Intro!

Trigger... it is an special stored procedure that cannot be called explicity by an application but get called on an event in the database. It is like a method we attach to an button click event in page.

Events are insert, update or delete data in a table. When one of these operation is called for in a given table, trigger fires for that table. Importantly, in a MS SQL Server, the trigger fires once for a given session and NOT FOR EACH AFFECTED ROW.

Triggers are useful to execute business logic which sometime cannot be managed completely by constraints or any other mechanism or is sometimes easier to accomplish as trigger. Triggers are kind of tricky to write and needs lot of care from developer to avoid any side effect and it sometimes becomes difficult to debug the code.

In general, it is not preffered to trigger, as they are not completely portable between database and it sometimes goes unnoticed or totally hidden and becomes nightmare to find some issue.

There are 2 types of trigger in MS SQL. One is after trigger and other one is instead of trigger. In SQL 2005, the trigger has been associated with table alter, create etc as well.

I shall write more about these trigger in detail later.

Wednesday, May 16, 2007

Needs immense talent and patience

Does it look very familiar? Eiffel tower!

What is so special about this picture? Yes, the picture is model made by my cousin. He made that using the rib of the each coconut leaves. He has taken so much care about the details that it is amazing. His talent and patience is really of no par! It took some hundreds of such sticks, as he wanted each every piece of to be of the similar thickness. He has to stick each of this together… I don’t even seem to have patience to write the details… but I had enough patience to take a picture and put a quick notes!

Posted by Picasa

Tuesday, May 15, 2007

Dataset Vs Datareader - Again!

On reading my previous post on Dataset vs Datareader, one asked me, which one is better. I wanted to reply that. Then I realized there is enough to say that I can put a separate blog entry.

It is a difficult black and white recommendation to make.

Typically, when we design application, we try to achieve something called decoupled layers. Which means different application layer know nothing or minimal about each other. So, we always prefer a disconnected architecture. So, we always try to avoid tying up/carrying around the database connection across different layer. So, dataset kind of object sounds a favorable solution.

So let us think about two simple operations we do. Handling list of rows and handling single row.

One more drawback of Dataset other being bulky, it is not strongly typed. As an attempt to solve this Microsoft came up with strongly typed dataset. But it became too bulky. Then, it made sense to fill a simple object (object with simple getter setter) - Service layer or Business layer would fill in this object using datareader and pass around the Simple object to the "View" layer. Hey, this is when you handling single row. But when it comes to multiple rows, 90% of time we bind them against some.

When it comes to list of objects, intention can be a lot as well - could be that we want to list those records, or we want to enable multiple edit or batch update, or we want to keep the database kind of parent child relationship and transverse through them or we want to keep the database constraints and want to modify the dataset, or we want to integrate with legacy system where XML based object would make sense, or we want to load XML and build a familiar dataset object, or get XML from the underlying datalayer,... etc. Yes, it is really overwhelming to write them together what we can do with Dataset. But usual, worry about Dataset is it being bulk. But MS has something called DiffGram to alleviate the situation to reasonable extent.

So you make decision with design, performance and necessity in mind and try to strike a balance.

Saturday, May 05, 2007

Dataset vs Datareader

One of the most common coding we do is fetch bunch of rows from the database and view them or manipulate them. In such cases, we have 2 choice with us. Either to use DataReader or DataSet. How do you decide between these choice?

It needs to be quick!!! - DataReader is quick when it comes to just read the data and your intention is not modify the data but just view them

I need to modify or cache or transfer between multiple tiers!!! - DataSet gives us a flexible data structure to handle, it is disconnected, can be cached and you can modify them and save them.

The DataReader approach is generally quicker because it avoids the overhead that is associated with created a DataSet object. The overhead that is associated with a DataSet object includes creating DataSet subobject such as DataTable, DataRows and DataColumns. However, the DataReader provides less flexibility, and is less suited to situations where you have to cache data and pass the data to components in an application that has multiple tiers. The DataAdapter used to fill the DataSet uses a DataReader internally.

DataReader is recommended when the following conditions are true:
  • You need forward-only, read-only access to data and you want to access the data as quickly as possible, and you do not need to cache it.
  • You have a data container such as a business component that you can put the data in.

DataSet is recommended when the following conditions are true:

  • You have to cache or pass the data between layers.
  • You require an in-memory relational view of the data for XML or non-XMLmanipulation. like constraint, parent child, search,
  • You want to update some or all the retrieved rows, and you want to use the batchupdate facilities of the SqlDataAdapter class.
  • You have to bind data to a control type that the DataReader cannot be bound to. Many Windows Forms controls capable of data binding require a data source that implements the IList interface. The DataSet implements IList, but the DataReader implements IEnumerable. IEnumerable supports data binding to most Web Formcontrols but not to certain Windows Forms controls.
  • You have to access multiple sets of data at the same time, and you do not want to hold open server resources.

Friday, May 04, 2007

Script element "defer" attribute

Sometime is required write to a script something similar to below code snippet,
<HTML><HEAD><TITLE>Defer attribute Example</TITLE>
function HelloWorld(){
<div id="bodyDiv">Hello world!!!</div>

Above code snippet works fine
You would see an alert on page load. Let us rewrite the above code slightly.
<HTML><HEAD><TITLE>Defer attribute Example</TITLE>
function HelloWorld(){
<div id="bodyDiv">Hello world!!!</div>
Check the bold portion of the above code. I am calling a script that would try to access a DIV tag which placed below the javascript. This would mean, as you see, the DIV tag is not yet rendered and javascript refers to that object and you will get an error (Refer the image)

To avoid this, you can let IE know that this scripts need to executed only after the page is loaded. It can be done using "defer" attribute of <script> tag. If you set <script defer='defer' >HelloWorld();</script>, this script block will be executed only after the page load.

Typically, above simple scenario can be handled using onload event of body. But this is for any reason it could not be established, this is the workaround. Firefox does not seems to have such issue though.

Wednesday, April 25, 2007

Renaming database

To rename the database, typically we have to take the database offline. But when you try to do that typically connection held to those database does not let you rename the database. So we need to take the database to Single User mode so that particular database accepts only one database connection. Dont try it take it "Single user" mode from Enterprise manager - then Enterprise manager itself will eat up the available connection and you will start sweating (If you are doing it live thinking these steps can be done quickly :)).

Go by TSQL way,

USE master GO
EXEC sp_dboption DevelopmentDB, 'Single User', True
EXEC sp_renamedb 'DevelopmentDB', 'ProductionDB'
EXEC sp_dboption ProductionDB, 'Single User', False

Wednesday, April 18, 2007

ASP Request Object

As we all know, web is all about Request and Response. You send your request to Webserver and Server sends you back the Response.

Server side programming has these 2 activities wrapped in to object called Request and Response object which help us to read or manipulate those object.

The Request Object receives the values that the client's browser passed to the server during an HTTP request.

Request Object has several namevalue "collections".
  • ClientCertificate: The values of fields stored in the client certificate that is sent in the HTTP request.
  • Cookies: The values of cookies sent in the HTTP request.
  • Form: The values of form elements in the HTTP request body.
  • QueryString: The values of variables in the HTTP query string.
  • ServerVariables: The values of predetermined server/environment variables.
The syntax is: Request[.collectionpropertymethod](variable)

All request object variables can be accessed directly by calling Request(variable) without the collection name. In this case, the Web server searches the collections in the following order:
  1. QueryString
  2. Form
  3. Cookies
  4. ClientCertificate
  5. ServerVariables

If a variable with the same name exists in more than one collection, the Request object returns the first instance encountered. It is strongly recommended that, when referring to members of the ServerVariables collection, the full name be used. For example, rather than Request("AUTH_USER") use Request.ServerVariables("AUTH_USER").

Thursday, March 29, 2007

You cannot back up databases to a network drive failed to open, operating system error = 5 (Access is denied.)

This error message usually occurs as a result of incorrect permissions to the network drive.

To enable backups to network drives, perform the following steps:

1.The SQL Server service must be started using a domain user account to access any resources on a remote computer. Verify that the MSSQLServer service is started under a domain account that has write access to both the Windows NT Server share and its underlying partition (if the partition is formatted with the Windows NT file system, or NTFS).
2.In Control Panel, double-click the Services icon.
3.Select the MSSQLServer service and then click Startup.
4.Examine the startup options for the service and verify that This Account is selected and that a valid domain account is supplied in the form Domain_Name\Domain_account (with the correct password).NOTE: If you changed the service to run under a domain account, you must stop and restart the MSSQLServer service.
5.Verify that the account specified has write access on the Windows NT share to which you are backing up, as well as the underlying partition (if the partition is formatted as NTFS). To do this, perform the following steps:
a.Right-click the share name in Windows NT Explorer.
b.Click Sharing on the shortcut menu.
c. On the Security tab, click Permissions.

Sunday, March 18, 2007

The project location is not trusted

Somedays back I download the AjaxControlToolKit zip file that had some sample implementations. But, when I tried to open the solution and I got an error saying "The project location is not trusted"

On googling, I found the probable reason is that - if you open client project on a Universal Naming Convention path - shared path.

[Btw, what is Universal Naming Convention path?? - In a network, the Universal Naming Convention (UNC) is a way to identify a shared file in a computer without having to specify (or know) the storage device it is on. In Windows operating systems, Novell NetWare, and possibly other operating systems, the UNC can be used instead of the local naming system (such as the DOS naming system in Windows). In Windows operating systems, the UNC name format is: \\servername\sharename\path\filename]

In my case, it was deceptive suggestion. There wasn't any UNC path referred and in the dialog box that shows error, show "C:\projects\..." path as non-trusted location.

Actual reason for this error was that I downloaded this Zip file, which I extracted to my project location, was from Internet and was NOT trusted by Windows and hence I had to "unblock" zip file. This you can do by "right-click" the zip file and go to properties and you would see "Unblock" button at the bottom on the dialog.

If you get this error because it actually refers to the UNC path, solution is

Thursday, March 08, 2007

Daylight saving - patch broke Vj++

Our website is nearly 10 years old. Started of as static webpages, now it is a complete enterprise application. Website has been suffering more and more changes, as we were getting more successful in business, over a period of time.
Someone on one fine day, decided let us use notorious Vj++ and ASP with JScript (for the benifit of java style syntax), though many people who used MS platform preffered to use VB and ASP together. But I am not sure if VB would have be powerful enough to have designed the application as it has been designed now. We have been paying for that decision for sometime.
1. Vj++ no more supported by MS
2. Vj++ does not supported multi processor - so we had to always make sure that the CPU affinity is set to one CPU for ASP application
3. I believe there would some performance set back and more to go....

To add more to this list, recently as we know, Daylist Saving logic has changed and Microsoft had a patch to cope with it. After we applied the patch, our application broke. It was very strange and it took some time to debug that.

Finally, found that the DST fix broke the dateformat returned by the Date object of Vj++. Previously, the dateobject returned time localized like EST, CST etc. But now, it always return in GMT and this change broke some part of the system. We had to then write a patch class that extends the current Date object and return the date in old format.


Content Delivery Network - this is a new concept of hosting the content in wide distributed network. In a website, we have lots of content. Contents are static and dynamic. Simple approach to CDN would be that the static contents are not going to change and we can cache the content or make the request to these static content less time consuming or we dont need the our server to server the static request.

Akamai, is one of the CDN provider. So it works like this. Akamai has around 20000+ servers set across different geographical location around the world. Request for some of the resources will be distributed all across these servers and client will get their content from closest server.

Let me explain in detail. Think of 20 images in a web page and assume the website is So when you refer to the images on the web page, it would look like <img src="" />

So, when the image is requested from the browser the request would land on to the servers. The round trip time or no of hops to this server would be different from different location around the world. This would affect the overall speed in the delivery of the content.

Instead, we can Akamai our contents. In the above example, once we sign up with Akamai they will give us a domain name. Eg. In our website, we refer to the image content as <img src="" />. So what happens now?

Now, comes something called Dynamic IP look up. Typically, when a browser makes a request "", the DNS directory returns the IP address mapped to this domain and the communication happens subsequently. But in this above case it works differently. "" would have different IP published in the different DNS directory on different location and hence the IP would be different from different location. Which would mean, the IP returned is one of their 20000+ servers, but closest to them. Thus it reduces a lots of network latency involved. So when a server get the request first time, it would request the server, and cache the image in to their server and all subsequent request will be served from Akamai servers. It is possible to purge the content using their admin tool so that we can refresh the cache.

Above description is very simple description about akamai.

Wednesday, March 07, 2007

1.x to 2 .net app migration!

I read this article online, just kept it here for my reference.

If you’ve read through various migration HOW-TOs, you might’ve noticed a suggestion to turn off batch compilation and rebuild your project to see if any compilation errors come up. This is a very important point as the section in web.config is a tricky one.

Here’s what an MSDN article suggests:
Open the web.config file and turn batch compilation off and re-compile that application to see if any further compilation errors might exist. This can be done by setting the batch=false attribute in the compilation tag as such: . Turning off batch compilation may expose masked compilation errors that may exist in the application but are not reported.
Important: The batch=false attribute should only be added to find such errors and then reverted once any additional compilation errors are fixed. Leaving batch=false in the compilation section has significant performance impact on build times for the application in Visual Studio 2005, so make sure you remove this attribute after doing this check.
More reading on this subject:

Don’t run production ASP.NET Applications with debug="true" enabled
Beware Of Deploying Debug Code In Production
PageParser.GetCompiledPageInstance Weirdness