There's something out there in life that will delight and amaze you.
Get up, get moving, and go find out what it is. - (Ralph Marston)

Thursday, August 31, 2006

Windows Live Writer(Beta)

One of my good frinds gave me this link and said its gr8 and easy to post articles in the Blog using this software..So I thought to give it a try

So here is the link

http://WindowsLiveWriter(Beta)DownLoads

I find it easy...guess it will be useful for those of us who always have the trouble in publishing posts; using the Blog itself.

Sunday, August 13, 2006

allowDefinition='MachineToApplication' beyond application level.

It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.

Above is an error which I continuously faced when I was trying to deploy a WebService written using VS2005.

I wrote a web service in vs 2005 and was trying to deploy it in IIS. What I did was created an empty folder and mapped the virtual folder to it. Then I published the Web Service giving that empty folder as the destination. In the IIS, I changed the ASP.NET version in IIS to 2.0 , but when I was trying to publish it gave the above error.

Well, after searching the web for so long; one day I tried out this..

created the web service and build it(no errors) then clicked on the publish option from the menu that drops down from the project I need to publish; it then requested the http URL, where I specified as http://localhost/TestSomeService, then it was published creating a folder in IIS as TestSomeService and mappings all done, and all I had to do was to change the ASP.NET version in IIS to 2.0. And there it worked fine....

One thing I learnt was that the new Visual Studio 2005; provides an inbuilt webhosting facility. it uses a Cassini to host the web service locally. This is good for developments; but as far as deployment is concerned; you got to go for IIS.

Friday, August 11, 2006

Accessing the ConnectionString in ASP.NET 2.0

It is a general practise; we define the connection string in the web.config file and access it from else where of the application when we need to handle database activities. In asp.net 1.1 and lower versions; in web.config file we define the connection string by specifying it as a key value pair tag under the . That is, we specify the connection details under the section of application settings. Just to recap, this is the way we’ve been using in normally.

 And access the connection string as follows. string ConnectionString = Configuration.AppSettings[“ConnectionString”].ToString(); The asp.net2.0 takes a one step forward and changes this by adding a tag just after the . So with in this we can specify any amounts of connections to the database. It will look as follows. Let’s see how we can do it in asp.net 2.0.

This is how we could access this connection defined in the web.config file. string strCon = ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString; The asp.net 2.0 uses the ConfigurationManager class which exposes the property of ConnnectionStrings where we could specify the key and access the connection string. If we want to get the application settings we could use the ConfigurationManager.AppSettings where this will give us the application settings of the web application.

Inorder to access the ConfigurationManager class we need to add the System.Configuration dll manually.

As you’ve seen now; ConfigurationManager class which is a new introduction in asp.net 2.0 allows us to carry out the general tasks in a bit different way; but guess; it’s trying to put things in to right places. Is it?