开发者

web.config urlmapping

开发者 https://www.devze.com 2023-01-05 16:04 出处:网络
I have a comment form on my website on contact.aspx. I want to be able to put up a redirect from /comment (no extension) to point to contact.aspx.

I have a comment form on my website on contact.aspx. I want to be able to put up a redirect from /comment (no extension) to point to contact.aspx.

I set up the following url mapping in my web.config and when I test locally it works fine. When I post it to production, the redirect doesn't happen and I get the IIS 404 error.

<system.web>
    <urlMappings enabled="true">
        <add
        url="~/comment"
        mappedUrl="~/conta开发者_运维知识库ct.aspx"/>
    </urlMappings>

I'm assuming this is because IIS isn't serving up the request to the asp.net engine and I'm using a shared hosting environment (discountasp.net) so I don't have direct control over IIS to configure it there. I can always put in the subfolder and a default.aspx that will redirect for me, but I thought I would inquire about this route first.

What does the collective think?


Ask your web host if they can configure your virtual directory to serve all requests through ASP.Net.

Many hosts (mine included) are willing to do this. (Mention ASP.Net MVC, which requires this)

0

精彩评论

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

关注公众号