I've tried to rewrite a URL of a .aspx page, but i find all times this error :
error 500.23 : An ASP.NET httpHandlers configuration does not apply in Managed Pipeline mode.
premise: I'm using Visual Studio 2012 and c#
web.config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<httpHandlers>
<add verb="*" path="viaggi/*.aspx" type="mioRewrite, mioRewrite"/>
</httpHandlers>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<appSettings>
<add key="strConn" value="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\db_viaggi.mdf;Integrated Security=True" />
</appSettings>
</configuration>
class mioRewrite inherited by the class IHttpHandlerFactory
public class mioRewrite : IHttpHandlerFactory
{
public IHttpHandler GetHandler(HttpContext context, string requestType, string URL, string pathTranslated)
{
classe HttpContext
context.Items["fileName"] = Path.GetFileNameWithoutExtension(URL).ToLower();
return PageParser.GetCompiledPageInstance(URL, context.Server.MapPath("viaggi.aspx"), context);
}
public void ReleaseHandler(IHttpHandler handler) { }
}
I've used this method because some samples talk about it.
What I've to do to solve this error, and for creating a URL rewrite method?