I found that under ASP.NET MVC 4 you can't define a bundle of Javascripts or CSSs if their virtual path is managed by a VirtualPathProvider. I mean, if directory "~/Static/" is mapped to a VPP you can't Include("~/Static/Stylesheets/themes/dark-blue.css") because it will simply and silently fail.
From here and here it really looks like this is the default behaviour of runtime, because it basically resolves the virtual path on file system rather than using ASP.NET pipeline. And, fortunately, it's to be implemented in next MVC.
Anyway, since this looks like being a common problem, and since I'm going to store static resources outstide of the project (ultimately on Azure's CDN, but I still have to develop&debug), did anyone find a workaround to let ASP.NET Web Optimization search for resources in their virtual paths?
VirtualPathProvider support is in the 1.1-alpha1 version of Optimization, have you tried that version out? It should support resolving files through your VPP.
Related
I have been using CKE 4.3.4 for a while (in conjunction with ASP.NET 4.0) and it is generally working fine. But I am having great trouble in configuring features in config.js where I need to specify a path - for example, for a custom stylesheet file (config.stylesSet) or a custom image browser (config.filebrowserImageBrowseUrl). I have only been able to get this to work by specifying an absolute url - e.g. //ckeditor/customstyles.js. Although this works, I am unhappy having to do so as it makes running my applications in different environments difficult and is also an issue when testing using IIS Express which does not provide a root name. I have seen suggestions elsewhere that I need to set a BASEHREF global variable, but I can't see why I shouldn't be able to do this within config.js itself rather than in some external script tag or whatever. I feel sure that I used to be able to do something similar with FCKEditor or earlier versions of CKEditor, so would be grateful if anyone could remind me of the correct syntax.
Jon
I'm working on legacy code in a DotNetNuke module, trying to get classes and behaviors under a testing framework: I'm taking this opportunity to follow advice from the "Working effectively with legacy code" book, so what happens is that i'm trying to define areas which can be tested thoroughly and then converted to services. Then i'd like to use an IoC framework for it to work. For now, i've set eyes on Ninject.
However i'm hitting a design problem: as i'm in a DotNetNuke module, i can't really change application-wide structure: for example i can't derive the Application from NinjectHttpApplication. I can't use these suggestions from SO either.
I was thinking about having the Kernel in a static class that my module would set up and then use but from what i've read around it's a very bad idea.
So i'm starting to ask myself if it's possible to use an IoC in an application that hasn't been set up to support it from scratch. If i'm supposed to have a whole dependency tree loaded for each request, how can i rewrite legacy code locally and benefit from IoC? Is there a pattern where IoC use can grow out from very local rewrites?
Even though i'm working with DotNetNuke, any standalone component that can be installed into an independent framework begs the same question. Also i'm not targeting Ninject specifically, if another IoC framework can help in this case i'm willing to consider it.
From my experience, your best bet to get this type of abstraction within the context of DotNetNuke is by using the WebFormsMVP framework. This is really the only sane way I've found to do unit testing in a DNN module, and if memory serves I spent awhile trying to wire up Ninject a year or so ago.
But be warned, it is still WebForms and will never be drop dead simple. And without knowing your existing code base, I'd have a hard time knowing how easy it will be to make the migration.
I have a couple of resources on GitHub that you can check out for reference:
The first is a module template that should act as a solid starting point:
https://github.com/irobinson/WebFormsMvp-DNN-Module-Template
The second is a small example project:
https://github.com/irobinson/BeerCollectionMVP
Depending on the version of DNN you're using, it may or may not already ship with WebFormsMVP, but you should be able to either bundle the dependencies w/ your module or upgrade to the newer version of DNN if that's reasonable.
I've created custom validators with localized strings which are loaded from my satellite resource assemblies. Now I want to override default MVC messages like "{0} must be a number".
In this article:
http://martinnormark.com/asp-net-mvc-localize-numeric-data-val-number-validation
the author says
I was browsing through the source code of ASP.NET MVC 4, and found a
changeset that looks like will fix this issue. In short, it will be
possible to define your own ResourceClassKey, and the MVC framework
will use that before using default error messages. Nice!
So I started looking how to use the new features but most of solutions seem outdated and don't work or maybe I'm doing something wrong.
How do I override client side error messages in MVC 4 using resource dll files?
Does MVC itself always decide which resource assembly to pick or I can somehow force it to pick the one I need for a specific language?
Somehow this article
http://www.codeproject.com/Articles/42168/Localizing-ASP-NET-MVC
did not appear in my earlier searches.
The key point was to add the App_GlobalResources folder manually and move resource assemblies there, and only then it picked up our custom messages.
For some reason the App_GlobalResources folder is missing when creating MVC 4 app in Visual Studio 2012 so we assumed that it is not needed any more. But when digging through the MVC source code, we found that MVC is using HttpContext.GetGlobalResourceObject which looks in App_GlobalResources. Oh, Microsoft, come on, why are you doing this... we spent three days looking for various complex solutions just because you threw out that folder from the latest MVC version.
Anyone knows how does the magento framework interact with the various codepools?
Magento has three different codepools:
Community
Core
Local
firstly it includes Local code pool, than community and after that – core, which allow developers to override classes without changing core files.
The autoloader firstly checks the local folder, than community, than core and than lib. And this is a reason why you can put Mage/Catalog/Model/Product.php in the local directory and it will be loaded instead of core class.
Environment: I am working on a site in ASP.Net 2.0 running on IIS6; I am developing locally on WinXP which runs IIS 5.1, using VS2005 and VB.
Issue: I am trying to create caching for some business layer objects (actually creating a caching layer) using System.web.caching.cache. This should be available under System.Web namespace but all that I seem to have access to are: AspNetHostingPermission, AspNetHostingPermissionAttribute and AspNetHostingPermissionLevel (I have a reference to System.Web in the project and imports in the class). There are quite a few other classes (e.g., HTTPRuntime) which also do not appear (this is per the "Using SQL Cache Dependencies" tutorial http://www.asp.net/web-forms/tutorials/data-access/caching-data/using-sql-cache-dependencies-vb).
I'm at the end of my rope and can't seem to find anything out there to explain this. Has anyone been in this situation and seen this before? Any help getting this solved is MUCH appreciated!
OK, so not sure why I didn't think of this before but I checked the references tab under the project properties. In the list for System.web, the additional namespaces were unchecked; checking System.Web.Caching and recompiling fixed the issue.
Sometimes you're just toooooo close to something to realize the easy answer.