简体   繁体   中英

root Path is not working in asp.net?

I have a site which is in online, two days back i create a new folder and uploaded the new version of the site in that folder and place the link button to redirect to new version site. when ever user click on the new version site it is redirecting to new version site. it is working fine when i click on any links of newversion site it is giving some path problems i try to modify that one even though it is not working. even i write direct url ( http://www.xxx.com/New tfc/xx.aspx") but it is not working the site is "tfc18.com" can u try this once

The problem coming at user controls path the error like

<%@ Register Src="http://www.tfc18.com/NEW TFC/footer.ascx" TagName="footer" TagPrefix="uc3" %>

err is

'http://www.tfc18.com/NEW TFC/footer.ascx' is not a valid virtual path.

尝试指定用户控件的虚拟路径:

<%@ Register Src="~/NEW TFC/footer.ascx" TagName="footer" TagPrefix="uc3" %>

You have to specify a virtual path like this:

<%@ Register Src="~/NEW TFC/footer.ascx" TagName="footer" TagPrefix="uc3" %>

This would tell the page to loook for a folder named "NEW TFC" in the root forlder of your application and then for a file named footer.ascx in it.

If you want to use files which are outside of the root folder of your application you have to use a custom virtual path provider. Here is a list of sample implementations of virtual path providers:

http://msdn.microsoft.com/en-us/library/system.web.hosting.virtualpathprovider.aspx http://www.thecodinghumanist.com/Content/VirtualPathProviderExample.aspx http://www.codeproject.com/KB/aspnet/Virtual_Path_Provider.aspx

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM