Tag Archives: ASP.NET

Cloud Hosting Experience

Recently, we have switched most of our hosting accounts over to Mosso’s (http://www.mosso.com) cloud hosting service. Previously, we were using virtual servers or dedicated servers to host all of our web applications and websites for Atlas Bay as well as our clients. My early experiences with Mosso have been great.

First, the technology Mosso uses is up to date and diverse. I can host websites using the latest version of .Net and PHP in the same folder without worry about configuring IIS to use PHP or any other complex scenarios. With Mosso, I can simply upload my application and it will figure out how to properly host it. So far everything has worked really well and been incredibly easy.

Second, there customer service has been incredible. I don’t really like to bother calling in to places for simple questions so I love there instant chat feature. On every page of their website and control panel there is a link to chat instantly with technical support. I have had every issue or question resolved in a matter or 1 or 2 minutes. It has been super convenient and saved me a lot of time.

Third, I love the integrated billing system. Now with Mosso, we dont have to create invoices for our hosting clients and process each payment separately. Mosso will take care of the billing and pay us directly. This service is really convenient and offered at a fair price (4% or $2, per transaction). For the amount of time this saves us I will gladly pay the service fee.

My one complaint, which is why we just started using Mosso, is that it took them a long time to roll out .net 3.5 sp1. I understand the issues with breaking changes, but I believe it is important for them and other hosting companies to making a commitment to supporting the newest technology. This is going to be an issue they will have to deal with in order to keep me as a long term customer. I can pretty much guarantee that if it takes them 6+ plus months to deploy the next version of .Net they will loose my business. Hopefully, they will have this worked out so they can quickly deploy new releases of frameworks and web servers without negatively impacting legacy software.

Overall, I am extremely satisfied with Mosso and I would recommend it to anyone who is deploying web applications on either Windows or Linux.

Robots.txt HttpHandler in IIS7

In a ongoing effort to automate more of my work I decided to build a HttpHandler for IIS that automatically creates my robots.txt files. This particular handler will create robots.txt files that block all search robots. This handler will be installed on our projects web server which is used for development purposes only, and as such we don’t want these pages being listed in search engines.

First, we create a class project in visual studio. Next, add a reference to System.Web. Then create one class titled RobotsHandler.cs and add the following code.

Capture_1

Next, we need to strongly sign the assembly. This is required because we are going to add this assembly to the GAC on our web server. See this link for instructions if you are not familiar with this concept. http://msdn.microsoft.com/en-us/library/xwb8f617.aspx

Now that our little class library is completed we need to build. Remember to change the compilation to Release. Now, copy the assembly to the web server and register it in the GAC. See this link for more details on using gacutil. http://msdn.microsoft.com/en-us/library/ex0ss12c(VS.80).aspx

After the assembly has been registered, we will register the handler in IIS7. See this link for instructions on how register a custom handler. http://technet.microsoft.com/en-us/library/cc753249.aspx. Remember to set the path of the handler to "robots.txt". This will intercept all requests to robots.txt and map them to your new handler.

Now, test to make sure everything worked correctly using your web browser. Go to http://www.mysite.com/robots.txt. You should see this text:

User-agent: * Disallow: /

You could definitely expand this to use custom rules from a database or configuration file. You could also set the file to allow all robots by changing "Disallow: /" to "Disallow:".

ASP.NET 3.5 Extensions CTP Released

I downloaded and tested the new ASP.NET 3.5 Extensions today. There are many new and exciting features in the CTP. My favorite is the MVC (Model View Controller) Framework and its accompanying tools. The MVC framework is a complete 360 from traditional ASP.NET forms pages in a number of ways. First, there is a very clear separation of the layers of your ASP.NET web app. Second, you will notice the HTML output of a MVC app is extremely clean. There are not viewstate or other hidden tags among other things. Third, and probably most important, is the page life cycle is very different. While ASP.NET MVC is built on top of System.Web many events from the old System.Web.UI.Page class are not fired inside the new ViewPage class.

From a application development standpoint I think this new framework will help developers and designers work better together. I don’t have to worry much about what goes into the .aspx page and the the designer doesn’t have to worry about dependencies in my code. ("Is it okay to change this datalist to a repeater?") As a developer I am only responsible for passing objects into ViewData. The designer can insert these values wherever they please. For example, lets say I make a simple have a PersonController with the action Person. This action accepts an id value. So the url might be http://www.example.com/People/Person/32. Using my DataContext from my SQL to LINQ I use dc.GetPerson(id) to retreive a single person. From there I simply use RenderView(string viewName, object viewData) to render the view and pass the person object to ViewData. The Person object will be automatically placed into the ViewData dictionary and be accessible on the view using ViewData["FirstName"] for example.

 
The controller.

 image_2
The view.

image_4

The end result is a very maintainable piece of software, a very nice URL for the end user and clean HTML output. It will be interesting to see how this project progresses and how it fits into our software at Atlas Bay.