string path = context.Server.MapPath("~/Temp");
or
string path = context.Server.MapPath("/Temp");
are same ?
I know that '~' represents root but want to know diff bw ~/folder
and /folder
string path = context.Server.MapPath("~/Temp");
or
string path = context.Server.MapPath("/Temp");
are same ?
I know that '~' represents root but want to know diff bw ~/folder
and /folder
See http://msdn.microsoft.com/en-us/library/ms178116(v=vs.100).aspx
~/
resolves to the application root./
resolves to the site root.When a server resource (like a control or view) is rendered,
~/
paths are resolved to site root paths based on the structure and context of the application (since~/
is meaningless to a web browser).To simplify, application root (
~/
) is almost always the correct choice in ASP.Net applications (both web forms and MVC).