URL Routing with ASP.Net 4.0

URL Routing in ASP.Net 4.0 allows us to easily set up “friendly” URL’s.

So instead of having URLs like mysite.com/ContactUs.aspx, mysite.com/ContentPage.aspx?ID=12, etc, you can instead have mysite.com/contact, mysite.com/our-products.

Setting up URL Routing is relatively straight forward.

First, open Global.asax.cs file for editing.

Add using System.Web.Routing; in header.

Create a new method (your short names and physical file names may be different):

void RegisterRoutes(RouteCollection routes)
        {
            routes.MapPageRoute("home", "home", "~/Default.aspx");
            routes.MapPageRoute("contact", "contact", "~/Contact.aspx");
            routes.MapPageRoute("solutions", "solutions", "~/Solutions.aspx");
            routes.MapPageRoute("who-we-are", "who-we-are", "~/WhoWeAre.aspx");
        }

Now call this method from within Application_Start event:

void Application_Start(object sender, EventArgs e)
        {
            // Code that runs on application startup
            RegisterRoutes(RouteTable.Routes);
        }

Rebuild your project, and new URL routes are ready to be used.

Overall a very simple and effective method. This article just scratches the beginning, you can read more about URL Routing in this MSDN article.

Advertisements

ILSpy – .Net Assembly Browser and Decompiler

ILSpy

ILSpy

ILSpy is a free .Net assembly browser and decompiler. I came across this application recently while looking for a replacement for .Net Reflector.

This tool was actually built by developer community after Red Gate started charging for the .Net Reflector.

The interface is nice and clean, and has a look and feel similar to that of Visual Studio. It can even look at assemblies that are in the GAC (File -> Open From GAC).
Once you have opened an assembly, all methods, properties, etc will be shown in the browser window, and you can view source code by clicking on relevant item.
It also has a class analyzer, which shows dependencies (Instantiated By, Exposed By and Extension Methods) if there are any.

ILSpy is very quick and easy to use, and in my experience worked perfectly.
I had a custom dll and no source for it, but with this tool I managed to extract all source code, copy it into new project and build without problems.
Highly recommended for .Net developers.

You can download it here.

Creating Asp.Net Web Service Application in Visual Studio 2010

One of the new things in Visual Studio 2010 is WCF Service Application. Among other things, this is also replacement for “old” asmx type web services, which are now considered legacy.

But what if you do need to create one of these “legacy” services? If you go to create a new project, you won’t find Asp.Net Web Service Application on the list of available project templates.

To solve this problem, on the project template screen, change framework version from 4.0 to 3.5 – and Asp.Net Web Service Application will now appear on the list of project templates. Once you have created your project, you can go to project properties, and change the framework back to version 4.0. Do a project build to verify that everything compiles, and you are all done.

Living in a Cloud

In the last few months, I’ve been doing a lot of work on the go – busy schedule required me to work from pretty much anywhere. As a result of this, I’ve started using several cloud based services. This meant that I wasn’t dependent on having to use my main computer for work – these services allowed me to do most things online, as long as I had access to the internet. This made my life so much easier, as now I didn’t have to worry about whether I had a copy of the latest version of the document I’m working on, or whether I remembered to copy important files to the laptop that I happen to be using at a time. So much so that now I try to avoid desktop applications if there is suitable cloud based alternative.

Now lets have a look at the services that will help you achieve digital freedom.

Gmail – you are probably already using this, but if you are not for some reason, sign up. This is Google reinventing email and making it so much better.

Google Docs – Online office suite, one word to describe it – brilliant. You can create text documents, presentations, spreadsheets, forms and drawings. You can also upload your existing documents (MS Office, OpenOffice, etc) and work with them online.

Dropbox – Online file storage, which gives you up to 2.25GB of free storage space. It has Windows / Mac / iPhone clients to automatically sync up files that you are sharing. You can also access all your files through a web browser.

Google Calendar – Another great product from Google. You can create events, invite participants, create and manage tasks. It also integrates nicely with Mac and iPhone.

Skype – Great free voice and video conferencing application. Also available for iPhone.

Scribblar – an online whiteboard, great for those conferences where participants are in different locations. You can share your whiteboard with other users, and there are lots of tools for drawing and editing. You can also save your images.

Gliffy – web based diagram editor. Create and share diagrams and drawings online.

And also keep an eye out for iCloud – a service that is soon to be released by Apple.

So if you are a person that spends a lot of time on the go, check these services out, they may make your life much easier.

OS X Lion

OS X Lion

Today I purchased OS X Lion from App Store and installed it on my MacBook Pro.

Install file size was 3.75GB and after downloading the setup launched automatically. Whole installation took about 30 minutes, and was very smooth, requiring no user input. After setup had finished, the system rebooted itself and that was it. My Mac was now running OS X Lion.

When you log in, you will notice two new icons on the dock – Mission Control and Launchpad.

Mission Control is a new interface that gives you a quick overview of what your Mac is doing at the moment. It shows you all applications that are running, and also allows for quick switching between  virtual workspaces. This is a feature that you will find useful if running lots of applications at the same time.

Launchpad is basically an iPhone / iPad interface for your Mac. You can move icons around and create folders like in iOS. It looks and acts very nice, like you would expect on iPhone / iPad. I was very impressed and found it to be a very nice addition.

One other thing that you will probably notice is that scrolling behavior has changed. Now by default it has what they call natural scroll direction. Which means that the content tracks “finger movement”, so it behaves (scrolls) the same way as iPhone and iPad – which is the opposite of how you use trackpad / mouse. This can be turned off in System Preferences -> Trackpad, un-tick “Scroll direction: natural”.

OS X Lion has over 250 new features, some of which include:

  • AirDrop – send files wirelessly to computers around you
  • Cocoa AppleScript applets
  • AutoSave – automatically saves changes to your documents as you work
  • FaceTime
  • FileVault 2 – full disk encryption
  • Full screen apps
  • Launch Pad
  • Mission Control
  • Multi touch gestures

You can see the full list of new features on the official site.

Note to developers – if you are using Xcode, you will have to upgrade to new version. It is free and you can get it from the App Store.

Overall, a very good upgrade which brings some nice new features and interface add-ons.

Boxer – DOS game emulator for Mac

Boxer

Boxer

Boxer for Mac allows you to play DOS games on your Mac. It uses DOSBox emulator to run games, and provides very nice looking and easy to use interface.

Installing games is as easy as dragging a zip file to Boxer. All the games I tried so far worked without problems.

One nice touch is the ability to set cover image for each game, and Boxer provides “shelf” view where all the cover images are laid out nicely on a shelf.

Download Boxer from official website.

iPhone App – ZX Spectrum Elite Collection

Today I downloaded this cool app (get it from iTunes), which allows you to play old classic ZX Spectrum games on your iPhone.

The app itself is free, as are a dozen of games that come with it – if you want more than what is provided in the download package, you’ll have to pay extra.

Included free games are:

  • Battleships
  • Batty
  • Beyond The Ice Palace
  • Buggy Boy
  • Chuckie Egg
  • Frank Bruno’s Boxing
  • Grand National
  • Harrier Attack
  • Kokotoni Wilf
  • Roller Coaster
  • Saboteur
  • Saboteur 2
  • Turbo Esprit
So as you can see even the free games have a few classics amongst them, like Batty, Turbo Esprit, Harrier Attack and Saboteur.
Graphics and sound overall are very good, and the controls are not bad – of course the touch screen doesn’t feel even close to the original Speccy keyboard, but it does the job.
So if you are feeling nostalgic, head over to App store and get this app – its free after all, and it will provide a great trip down memory lane.