Code reading summary of asp.net startkit timetracker (Application path processing notes)

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.