I am using dotLess.
I followed all their instructions (which seems simple enough) it's only 4 steps :)
my minimal web.config looks like this:
<configuration>
<configSections>
<section name="dotless" type="dotless.Core.configuration.DotlessConfigurationSectionHandler,dotless.Core" />
</configSections>
<dotless minifyCss="false" cache="true" />
<system.web>
<httpHandlers>
<add type="dotless.Core.LessCssHttpHandler, dotless.Core" validate="false" path="*.LESS" verb="*" />
</httpHandlers>
</system.web>
<system.webServer>
<handlers>
<add name="LessHttpHandler" type="dotless.Core.LessCssHttpHandler, dotless.Core" preCondition="integratedMode" path="*.less" verb="*" />
</handlers>
</system.webServer>
</configuration>
I've added my .less files in my content folder (i am using ASP.NET MVC - Razor ViewEngine)
my layout has a link to my .less include file:
<link rel="stylesheet/css" type="text/css" href="#Url.Content("~/Content/Site.less")" />
I have also added the a reference in my web application to dotless.Core.dll
Yet despite all of the when i do a simple styling of the page's body backround to black, nothing happens, for some reason it aint kicking in.
Am i missing something here?
Do you set the httphandler to run on requests? Add this:
<configuration>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"></modules>
</system.webServer>
</configuration>
have you tried accessing the Site.less file directly with your browser? If there is a syntax error in your less it will be output there..
If you get a 404 on that page the web.config is the problem, but I can't find anything wrong with it at the moment.
Are you running in Cassini or are you running on IIS7?
I'm not sure if this may be the cause, but in your link tag, rel value should be "stylesheet", not "stylesheet/css".
Also, I don't use ASP MVC but don't you need a tag around the Url.Content, like so?
<%= Url.Content("~/Content/Site.less") %>
Have you tried setting the cache to false? On some machines I've had issues with it.
Related
I am getting 404 not found status codes for my minified javascripts files and also there is an error ASP.Net ajax client side framework failed to load.
I have given my configuration settings in the web.config below,
<httpModules>
<!-- Component Art-->
<add type="ComponentArt.Web.UI.UploadModule,ComponentArt.Web.UI" name="ComponentArtUploadModule"/>
<!--Blog Engine-->
<add name="WwwSubDomainModule" type="BlogEngine.Core.Web.HttpModules.WwwSubDomainModule, BlogEngine.Core"/>
<add name="UrlRewrite" type="BlogEngine.Core.Web.HttpModules.UrlRewrite, BlogEngine.Core"/>
<add name="CompressionModule" type="BlogEngine.Core.Web.HttpModules.CompressionModule, BlogEngine.Core"/>
<add name="ReferrerModule" type="BlogEngine.Core.Web.HttpModules.ReferrerModule, BlogEngine.Core"/>
<!--Remove the default ASP.NET modules we don't need-->
<remove name="PassportAuthentication"/>
<remove name="Profile"/>
<remove name="AnonymousIdentification"/>
</httpModules>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<add type="DevExpress.Web.ASPxClasses.ASPxHttpHandlerModule, DevExpress.Web.v10.2, Version=10.2.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" name="ASPxHttpHandlerModule"/>
</modules>
<handlers>
<add name="ComponentArtScriptHandler" type="ComponentArt.Web.UI.ScriptHandler,ComponentArt.Web.UI" path="ComponentArtScript.axd" verb="*" />
</handlers>
</system.webServer>
I cant figure out whether I am missing any configuration or added something extra. Can somebody have a look
If you're getting "not found" error, there's something wrong with resolving the path. Either the path/file doesn't exist (because it's somewhere else for instance), or you have some conflicting rules in rewrite/routing engine.
Try to use, as a temporary fix, absolute paths. That means instead of
href="../../my.js"
you'd write
href="http://mypage.com/js/my.js"
Similar to #walther
href="/js/my.js"
As the first slash will take the path to the root of the URL, so useful for when moving between different environments (provided your dev isn't in a subfolder).
I hope that you can help me with the below problem.
I am using ASP.NET MVC 3 on IIS7 and would like my application to support username's with dots.
Example: http://localhost/john.lee
This is how my Global.asax looks like: (http://localhost/{username})
routes.MapRoute(
"UserList",
"{username}",
new { controller = "Home", action = "ListAll" }
);
The applications works when I access other pages such as http://localhost/john.lee/details etc.
But the main user page doesn't work, I would like the app to work like Facebook where http://www.facebook.com/john.lee is supported.
I used below code and it didn't work for me at all:
<httpRuntime relaxedUrlToFileSystemMapping="true" />
I was able to use below code and get the app to accept dots but I definitely wouldn't like to use below code for many different reason, please tell me there is a way to overcome this problem.
<modules runAllManagedModulesForAllRequests="false" />
Add a UrlRoutingHandler to the web.config. This requires your url to be a bit more specific however (f.e. /Users/john.lee).
This forces every url starting with /Users to be treated as a MVC url:
<system.webServer>
<handlers>
<add name="UrlRoutingHandler"
type="System.Web.Routing.UrlRoutingHandler,
System.Web, Version=4.0.0.0,
Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"
path="/Users/*"
verb="GET"/>
</handlers>
</system.webServer>
Just add this section to Web.config, and all requests to the route/{*pathInfo} will be handled by the specified handler, even when there are dots in pathInfo. (taken from ServiceStack MVC Host Web.config example and this answer https://stackoverflow.com/a/12151501/801189)
This should work for both IIS 6 & 7. You could assign specific handlers to different paths after the 'route' by modifying path="*" in 'add' elements
<location path="route">
<system.web>
<httpHandlers>
<add path="*" type="System.Web.Handlers.TransferRequestHandler" verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" />
</httpHandlers>
</system.web>
<!-- Required for IIS 7.0 -->
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add name="ApiURIs-ISAPI-Integrated-4.0" path="*" type="System.Web.Handlers.TransferRequestHandler" verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
</location>
I was facing the same issue. So the best solution for me is:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"></modules>
<system.webServer>
For anyone getting an 'Cannot create abstract class' exception when using the UrlRoutingHandler approach, it's likely due to:
Using a restricted 'path' (e.g. path="/Files/*") in your web.config declaration, and
A folder/path with the same name exists in your project
I don't think the dot is the problem here. AFAIK the only char that should not be in the user name is a /
Without seeing the route that matches john.lee/details it's hard to say what's wrong, but I'm guessing that you have another route that matches the url, preventing the user details route from being matched correctly.
I recommend using a tool like Glimpse to figure out what route is being matched.
I have a handler, on runtime it create a watermark on images from a specific folder. The problem is that it worked, but now it doesn't.
All that I did was to changed the hosting.
My web.config looks like this:
<handler>
<add verb="*" name="ImageWatermarkHandler" type="ImageWatermarkHandler"
path="Pics/*.jpg,Pics/*.png" modules="IsapiModule"
scriptProcessor="C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll"
resourceType="Unspecified" preCondition="integratedMode" />
</handler>
Can you please help me?
Under IIS 7, you have to specify custom http handlers and modules under the configuration/system.webServer/handlers element of your web.config (unlike older IIS versions, where the element is configuration/system.web/httpHandlers).
There's difference between integrated mode (you only need the handlers part) and classic mode(you need both handlers and httpHandlers). For details see the MSDN entry
Edit: At first I haven't noticed the precondition for integrated mode, could it be that the new hosting runs your app in classic mode?
your config file should look like this,
<configuration>
<system.web>
<httpHandlers>
<add verb="*" path="Pics/*.jpg,Pics/*.png" type="ImageWatermarkHandler"/>
</httpHandlers>
</system.web>
<system.webServer>
<handlers>
<add verb="*" path="Pics/*.jpg,Pics/*.png" name="ImageWatermarkHandler" type="ImageWatermarkHandler"/>
</handlers>
<validation validateIntegratedModeConfiguration="false"/>
</system.webServer>
</configuration>
for more information,
http://msdn.microsoft.com/en-us/library/bb515343.aspx
I have an asp.net website using the form controls from Telerik. It's just moved to a new server but I keep getting a 500 Internal Server Error.
Removing the httpHandlers section of the web.config makes server error go away, although then it complains if there is a Telerik control on the page. The whole config file is valid XML. Is there anything wrong with this code?
<httpHandlers>
<add path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI, Version=2008.2.826.20, Culture=neutral, PublicKeyToken=121fae78165ba3d4" validate="false"/>
</httpHandlers>
I see you mention it has just moved to a new server. Was this an IIS6 to IIS7+ migration?
IIS7 uses <system.webServer\handlers> instead of the IIS6 <httpHandlers> section. On top of this it will throw an error by default if you have the settings in the old section even if the new section is populated correctly.
Try this:
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true" />
<!-- modules here -->
</modules>
<handlers>
<!-- modules here -->
<add name="Telerik.Web.UI.WebResource" path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI, Version=2008.2.826.20, Culture=neutral, PublicKeyToken=121fae78165ba3d4" />
</handlers>
</system.webServer>
The validateIntegratedModeConfiguration="false" will allow you to keep your httpHandlers section populated without throwing an error (useful if you are debugging on a cassini / iis6 server) and the entry in the <handlers> section will configure it for your IIS7 server.
The runAllManagedModulesForAllRequests="true" is not strictly required but you will probably find yourself needing it if you are new to configuring IIS7 :)
Is the new server perhaps running IIS7?
Then try this
<system.webServer>
<handlers>
<add path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI, Version=2008.2.826.20, Culture=neutral, PublicKeyToken=121fae78165ba3d4" validate="false"/>
</handlers>
</system.webServer>
Also, make sure you have the exact version that you have specified in the Handlers section. You do not actually need the Version, Culture, and Public Token parameters specified in your web.config in order for it to work. They are there incase you are using more than one version in your application. Without them being specified, the server will use the first one that it finds referenced in your project. So, if you are only using one version of an assembly, you can omit the parameters.
Make sure that you have the Telerik DLL Telerik.Web.UI.dll referenced in your project and that CopyLocal is set to "true". Also, make sure (using File | Properties) that you have the right version on the server, too.
I am attempting to add a aspx page inside orchard cms application. I have placed my aspx page in a folder /Web/Test.aspx in the Orchard.Web web application. Note: I am using the source of orchard at the moment. I also added the necessary handler, as posted in this post, in the system.webServer tag in the config. Currently getting 'The resource cannot be found.'
Here is what my web config looks like around the system.webServer tag.
<configuration>
<system.webServer>
<handlers accessPolicy="Script">
<!-- already listed, not added by me -->
<clear/>
<!-- added by me -->
<add name="ASPX" path="*.aspx" verb="*" type="System.Web.UI.PageHandlerFactory" preCondition="integratedMode" requireAccess="Script">
<!-- already listed, not added by me -->
<add name="NotFound" path="*" type="System.Web.HttpNotFoundHandler" preCondition="integratedMode" requireAccess="Script"/>
</handlers>
</system.webServer>
</configuration>
I'm I missing anything?
Remove the clear tag and the Notfound handler and then try again.