asp.net mvc - MVC Razor View not found if filename contains a dot -


i have problems accessing route, if contains dot. reproducing, create default mvc4 webapi application. take default route...

routes.maproute(    name: "default",    url: "{controller}/{action}/{id}",    defaults: new { controller = "home", action = "index", id = urlparameter.optional } ); 

write controller follows...

public class homecontroller : controller {    public actionresult index(string id)    {       if (id == null)       {          return view();       }       else       {          return partialview(id);       }    } } 

and create 2 files "test.cshtml" , "test.menu.cshtml" next existing "index.cshtml".

opening /home/index/test works expected. brings contents of "test.cshtml".

however, opening /home/index/test.menu brings 404 error.

why happen? , how can avoided?

the 404 error seeing iis. module mvc routing never getting control.

adding following option modules section of <system.webserver> section in web.config make sure mvc routing gets attempted , should fix problem:

runallmanagedmodulesforallrequests="true"

in web.config there no existing modules section added following line <system.webserver> section:

<modules runallmanagedmodulesforallrequests="true" />

and works me.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -