Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top