In the development of our directory structure for the entire process of clarity, hope will build a number of different file directories.
For example, the structure is as follows:
|root
|pic
|web
|usercontrol
In the Web directory, how do we get to the picture path in the pic directory?
Method 1:
Let's look at the asp.net startkit timetracker solution First:
A public method is defined in class global asp.net startkit timetracker:
public static string Getapplicationpath (HttpRequest request)
{
string path = string. Empty;
Try
{
if (request). Applicationpath!= "/")
Path = Request. Applicationpath;
catch (Exception e)
{
throw e;
return
path;
}
Make calls where needed, for example:
<a href= ' <%= global.getapplicationpath (Request)%>/<%# (ASPNET. StarterKit.TimeTracker.BusinessLogicLayer.TabItem)
Container.DataItem). Path%> ' >
<%# (ASPNET. StarterKit.TimeTracker.BusinessLogicLayer.TabItem) Container.DataItem). Name%>
</a>
I have modified this method:
I first define a page base class.
public class PageBase:System.Web.UI.Page
Allow other ASPX pages in the system to inherit pagebase.