Thursday, February 21, 2008

Making Sense of Application Paths in ASP.NET

Path names in ASP.NET may be confusing, but the concepts are simple:

Physical paths refer to the server's filesystem (e.g., c:\inetpub\wwwroot\index.aspx).
Virtual paths refer to HTTP paths, the stuff in the browser address bar.

They come in two types: absolute and relative.

Absolute virtual paths are exactly what you see in the browser, starting with the / after the host name (e.g., /kiran/articles).
Relative (or app-relative) virtual paths start with ~/. The ~/ is magic and always represents the root virtual path of your application. So for an IIS application deployed at /India/culture/ ASP.NET transforms ~/ into /India/culture/. If the app is deployed to the IIS root (/), then ~/ simply becomes /.

For more information please refer to
1. ASP.NET Paths

No comments: