문제

I use the following my .net applications to resolve the path to an image or css file or javascript file.

<%=ResolveUrl("~/Scripts/myscript.js")%>

<%=ResolveUrl("~/images/myimage.jpg")%>

All my pages and controls inherit from a base page or base user control.

I have tried but didnt succeed in overriding the ResolveUrl method so that I could include some custom logic in the files path.

Any ideas how I might override the ResolveUrl method? Alternative is to create my own custom method that does similar but would prefer to work with ResolveUrl.

도움이 되었습니까?

해결책

ResolveUrl is not virtual so you will have little success using an override and it does not internally use anything that you can override to customize the functionality. That leaves you with writting your own utility function.

다른 팁

I would create your own ResolveCustomUrl method so that future developers don't go crazy

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top