Friday, 26 October 2007

Creating a root Virtual Path usng Cassini

If you ever wondered how to create a root Virtual path using the new ASP.NET2.0 Web Development Server (Casini)? It’s easy!

At the moment our application is having problems mapping images correctly because it will not accept http://localhost:8080/WebUI/default.aspx
Even if I create an IIS virtual directory http://localhost/WebUI/default.aspx it will still not be good enough.
(I know I know it is this stupid third party CMS and I have no control over its relative mappings)

I need something like the following:

http://localhost:8080/default.aspx

Create an external tool from “Tools” > “External Tools…”
Add a new external tool and call it “WebServer on port 8080 (or whatever port you want)
In the command point to casini which is located at C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\WebDev.WebServer.EXE
Have the argument as the following so that you assign the port and the path is directly in the Project Directory as follow:/port:8080 /path:$(ProjectDir)
Click ok
Then run the tool by going “Tools” > “Web Server on Port 8080”
Cassini will now run in the task bar with http://localhost:8080/
In the Properties Page of your web project, select “Start Options” and select “Use custom server” radio button
Type the Base URL as http://localhost:8080/
OK

No comments: