简体   繁体   中英

web.config urlmapping

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="~/contact.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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM