Asp.net tips: Get rid of Path Problems (2)

Source: Internet
Author: User
Tags comparison table

The previous day, I wrote a post due to path problems during the development process. Because I have developed something that can definitely be stored in the root directory, so I have not considered transferring it to other sub-directories in the future. Ahnan and lostinet promptly pointed out this defect. Next, I will introduce the improved version 2.0:

1. Change filename to filename. ashx for access to all images and CSS.
2. Write a configuration file containing a comparison table of all images, CSS file names, and paths.
3. Write a custom httphandler and respond to *. ashx. Query the configuration file and route it to the correct file.
4. Because httphandler responds to all static files (these files are cached by IIS), the cache function should be implemented.

Advantages:
Centralized routing. After the file location changes, you can simply change the configuration file.
Disadvantages:
Unable to preview the interface design due to lack of runtime support
Supplement:
This routing handler can also route pages such as aspx and implement more functions with urlrewrite.

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.