开发者

How to make a specific ASP.NET page unavailable?

I have an ASP.NET 2.0 web application. I want to prevent this application from serving a specific page. Is there any IIS setting I can specify to prevent requests to this page? Or any other way I can take this specific page offline or unaccessible without having to modify the code & redeploy?

If I delete the .aspx, will that throw a 404 or will 开发者_开发百科it mean the end of the world?

edit: this application is running on IIS6


If you are using IIS7.x you can install the ISS URL Rewrite Module and then create a rule for this page. You could do a 301 permanent redirect to another page (such as a static html file or aspx page) or a temporarily moved redirect.

If you are using IIS6 you can use the feature described in this post which is also entirely valid for IIS7 and is discussed in the linked article.


Add to your web.config

<location path="noaccess.aspx">
    <system.web>
        <authorization>
            <deny users="*"/>
        </authorization>
    </system.web>
</location>

Users will get a not authorized error.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜