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.
Related
My application has a custom HTTPModule for handling friendly URLs.
And here is the modules section of the web.config file.
<modules>
<remove name="ScriptModule"/>
<remove name="Session"/>
<add name="Session" type="System.Web.SessionState.SessionStateModule" preCondition=""/>
<add name="NHibernateSessionModule" type="MyApp.Core.NHibernateBase.NHibernateSessionModule"/>
<add name="ApplicationModule" type="MyApp.ApplicationModule"/>
<add name="URLDispatcher" type="MyApp.URLDispatcher"/>
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</modules>
The module also has logic to handle error pages. The problem that I have now is when a request with a url ending with '.' is sent to the server, none of my modules are triggered and the user sees the default asp.net 404 page.
Not sure what's happening and how to redirect the users to my custom 404 page.
I did find another question related to this, and the solution provided was to use one of the .Net 4 specific configuration tag in the web.config file. At the moment I am not in a position to move to .Net 4. So, I am looking for a different solution. Any suggestions?
I guess you are using http redirection for friendly urls.
If the application is under IIS7 , please check that you have installed the following feature:
Control Panel --> Progams --> Turn off windows features --> World wide web Services --> Common HTTP Features –> HTTP Redirection
And then you need to config your custom http module not only in
<system.web>
<httpModules>
<add name="CustomModule" type="NameSpace.ClassName, AssemblyName" />
</httpModules>
</system.web>
but also in
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="CustomHttpModule" type="NameSpace.ClassName" />
</modules>
</system.webServer>
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 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.
I'm using url rewriting.net. I'm testing web on the local host, it is successfully work. But When i deploying web to remote host, url rewriting not work. Problem is (The resource cannot be found). I found problem. My deployed remote host IIS configuration is (Virtual dir->Properties->Home directory->Application Mapping->.aspx->Edit->"Check that file exist" is checked). I need to uncheck them. But my deployed host control panel not have a application mapping function.
How to uncheck this option using web.config?
Is it possible?
Has you another idea?
IIS6
If this is IIS6 then unfortunately there is no way to change the script map settings via your ASP.NET web.config file.
You would need to find a hoster that permitted this configuration change via their control panel, or ask your present hoster (nicely) to change this for you.
IIS7
If this is IIS7 then you need to add (if it doesn't already exist) a <system.webServer /> configuration section to your web.config file and modify the handler behaviour:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<!-- remove existing handlers -->
<remove name="PageHandlerFactory-ISAPI-2.0" />
<remove name="PageHandlerFactory-Integrated" />
<!-- add back but set resourceType="Unspecified" to prevent
checking if file exists -->
<add name="PageHandlerFactory-ISAPI-2.0"
resourceType="Unspecified"
path="*.aspx"
verb="GET,HEAD,POST,DEBUG"
modules="IsapiModule"
scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll"
requireAccess="Script"
preCondition="classicMode,runtimeVersionv2.0,bitness32"
responseBufferLimit="0" />
<add name="PageHandlerFactory-Integrated"
resourceType="Unspecified"
path="*.aspx"
verb="GET,HEAD,POST,DEBUG"
type="System.Web.UI.PageHandlerFactory"
preCondition="integratedMode" />
</handlers>
</system.webServer>
</configuration>
This will only work if your hoster has delegated read/write access to the Handler Mappings feature.
I'd be fairly surprised though if this was IIS 7 and the PageHandlerFactory-ISAPI-2.0 and PageHandlerFactory-Integrated handler were configured as resourceType="File" or resourceType="Either". Out of the box they're configured not to check for the existence of files and folders.