asp.net mvc 5 - MVC 5 HTTP Error 403.14 - Forbidden -
i have got problem if phone call url
http://localhost:5330/admin/
it throws me
http error 403.14 - forbidden
while giving works fine
http://localhost:5330/admin/index
web.config:
<?xml version="1.0" encoding="utf-8"?> <!-- more info on how configure asp.net application, please visit http://go.microsoft.com/fwlink/?linkid=301880 --> <configuration> <configsections> <!-- more info on entity framework configuration, visit http://go.microsoft.com/fwlink/?linkid=237468 --> <section name="entityframework" type="system.data.entity.internal.configfile.entityframeworksection, entityframework, version=6.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" requirepermission="false" /> </configsections> <system.web> <authentication mode="none" /> <compilation debug="true" targetframework="4.5.1" /> <globalization uiculture="es-us" culture="es-us"></globalization> <httpruntime targetframework="4.5.1" /> <pages> <namespaces> <add namespace="kendo.mvc.ui" /> </namespaces> </pages> </system.web> <system.webserver> <handlers> <!--register windows login managed handler.--> <add name="windows login handler" path="login" type="csp.web.windowsloginhandler" verb="get,post" precondition="integratedmode" /> </handlers> <modules> <remove name="formsauthenticationmodule" /> </modules> </system.webserver> <runtime> <assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentassembly> <assemblyidentity name="newtonsoft.json" publickeytoken="30ad4fe6b2a6aeed" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-6.0.0.0" newversion="6.0.0.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="system.web.http" publickeytoken="31bf3856ad364e35" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-5.2.2.0" newversion="5.2.2.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="webgrease" publickeytoken="31bf3856ad364e35" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-1.6.5135.21930" newversion="1.6.5135.21930" /> </dependentassembly> <dependentassembly> <assemblyidentity name="microsoft.owin.security" publickeytoken="31bf3856ad364e35" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-3.0.0.0" newversion="3.0.0.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="microsoft.owin" publickeytoken="31bf3856ad364e35" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-3.0.0.0" newversion="3.0.0.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="microsoft.owin.security.oauth" publickeytoken="31bf3856ad364e35" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-3.0.0.0" newversion="3.0.0.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="antlr3.runtime" publickeytoken="eb42632606e9261f" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-3.5.0.2" newversion="3.5.0.2" /> </dependentassembly> <dependentassembly> <assemblyidentity name="system.web.helpers" publickeytoken="31bf3856ad364e35" /> <bindingredirect oldversion="1.0.0.0-3.0.0.0" newversion="3.0.0.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="system.web.webpages" publickeytoken="31bf3856ad364e35" /> <bindingredirect oldversion="1.0.0.0-3.0.0.0" newversion="3.0.0.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="system.web.mvc" publickeytoken="31bf3856ad364e35" /> <bindingredirect oldversion="0.0.0.0-5.2.2.0" newversion="5.2.2.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="microsoft.owin.security.cookies" publickeytoken="31bf3856ad364e35" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-3.0.0.0" newversion="3.0.0.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="system.net.http.formatting" publickeytoken="31bf3856ad364e35" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-4.0.0.0" newversion="4.0.0.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="system.web.webpages" publickeytoken="31bf3856ad364e35" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-3.0.0.0" newversion="3.0.0.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="system.web.http" publickeytoken="31bf3856ad364e35" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-5.2.2.0" newversion="5.2.2.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="newtonsoft.json" publickeytoken="30ad4fe6b2a6aeed" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-6.0.0.0" newversion="6.0.0.0" /> </dependentassembly> </assemblybinding> </runtime> <system.web.extensions> <scripting> <webservices> <jsonserialization maxjsonlength="500000000" /> </webservices> </scripting> </system.web.extensions> <entityframework> <defaultconnectionfactory type="system.data.entity.infrastructure.sqlconnectionfactory, entityframework" /> <providers> <provider invariantname="system.data.sqlclient" type="system.data.entity.sqlserver.sqlproviderservices, entityframework.sqlserver" /> </providers> </entityframework> <system.data> <dbproviderfactories> <remove invariant="system.data.sqlclient.4.0" /> <add name="microsoft sql server provider 4.0" invariant="system.data.sqlclient.4.0" description=".net framework info provider microsoft sql server" type="system.data.sqlclient.sqlproviderfactory, system.data.sqlclient, version=4.0.0.0, culture=neutral, publickeytoken=89845dcd8080cc91" /> </dbproviderfactories> </system.data> </configuration>
global.asax.cs:
using csp.web.models; using system; using system.collections.generic; using system.data.entity; using system.linq; using system.web; using system.web.mvc; using system.web.optimization; using system.web.routing; namespace csp.web { public class mvcapplication : system.web.httpapplication { public mvcapplication() { this.registerwindowsauthentication(); } protected void application_start() { database.setinitializer<applicationdbcontext>(null); filterconfig.registerglobalfilters(globalfilters.filters); routeconfig.registerroutes(routetable.routes); bundleconfig.registerbundles(bundletable.bundles); } protected void application_error() { httpcontext ctx = httpcontext.current; system.exception exe = ctx.server.getlasterror(); //if (exe.message.contains("undefined")) //{ // return; //} //else //{ keyvaluepair<string, object> error = new keyvaluepair<string, object>("errormessage", ctx.server.getlasterror().tostring()); csp.web.helpers.log objlog = new csp.web.helpers.log(); objlog.logerror(ctx.server.getlasterror().tostring()); ctx.response.clear(); response.redirect(string.format("/error/{0}", "showerror")); ctx.server.clearerror(); //ctx.response.end(); //} } } }
that right behavior. when invoke /admin/, tries list contents of folder, of course of study forbidden iis (by default). invoking /admin/index takes index()
action of admincontroller
.
your solution set default routing /admin/ forwards /admin/index. create sure have below lines somewhere in global.asax.cs
:
// default mvc route (fallback) routes.maproute( "default", // route name "{controller}/{action}/{id}", // url parameters new { controller = "home", action = "index", id = urlparameter.optional } // parameter defaults );
asp.net-mvc-5 iis-8
No comments:
Post a Comment