How get relative virtual path from physical path in asp.net?

Maybe this question is what you're looking for. There they suggest: String RelativePath = AbsolutePath. Replace(Request.

ServerVariables"APPL_PHYSICAL_PATH", String. Empty).

In ASP.NET server controls that reference resources, you can use absolute or relative paths as you do for client elements. If you use relative paths, they are resolved relative to the path of the page, user control, or theme in which the control is contained. For example, imagine that you have a user control in a Controls folder.

The user control contains an Image Web server control whose ImageUrl property is set to the following path: Images/SampleImage.jpg. When the user control runs, the path will resolve to the following: /Controls/Images/SampleImage.jpg. This is true no matter what the location is of the page that hosts the user control.

Absolute paths are not portable between applications. If you move the application that the absolute path points to, the links will break. Relative paths in the style of client elements can be difficult to maintain if you move resources or pages to different folders.

To overcome these disadvantages, ASP.NET includes the Web application root operator (~), which you can use when specifying a path in server controls. ASP.NET resolves the ~ operator to the root of the current application. You can use the ~ operator in conjunction with folders to specify a path that is based on the current root.

The following example shows the ~ operator used to specify a root-relative path for an image when using the Image server control In this example, the image file is read from the Images folder that is located directly under the root of the Web application, regardless of where in the Web site the page is located. You can use the ~ operator in any path-related property in server controls. The ~ operator is recognized only for server controls and in server code.

You cannot use the ~ operator for client elements.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions