开发者

How do I get the site root to return the correct page w/ ASP.NET MVC + WebForms + ISS 6 Wildcard mapping?

Currently, I'm converting a web application from web forms to ASP.NET MVC. The project has been converted and IIS 6 is setup w/ wildcard mapping. I also have made one MVC view/controller that works just fine. There is one problem though. When accessing the the site root, the routing engine kicks in and redirects the user to the default controller, instead of the default page setup in IIS. Is there a way to have IIS use the default page, before the routing engine kick开发者_开发百科s in?

If not...

I have tried to have the default controller just redirect the user to the default page (LoginPage.aspx). That works except that web.config authorization seems to think that the path is not authorized, thus it redirects to path that looks like http://dev01/SampleWebApp/LoginPage.aspx?ReturnUrl=%2fSampleWebApp

If go to the default controller directly (http://dev01/SampleWebApp/default/) the user gets re-directed to the login page with the correct path.

So is there a way to get the site root to by pass web.config authorization and redirect to the login page w/o the ReturnUrl?

Any help is greatly appreciated.

Thanks, Darren


at the top of the routes config in global.asax:

routes.IgnoreRoute("LoginPage.aspx");

or:

routes.IgnoreRoute("/");

haven't tried it, but one of those 2 options should work.


So the solution my problem was to use url mappings in the web.config under the system.web tag:

<urlMappings enabled="true">
    <add url="~/" mappedUrl="~/LoginPage.aspx"/>
    <add url="~" mappedUrl="~/LoginPage.aspx"/>
</urlMappings>

"~/" will re-direct the http://dev01/SampleWebApp/ path.

"~" will re-direct the http://dev01/SampleWebApp path.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜