如何限制对文件的访问,在ASP.NET特定扩展? [英] How do I restrict access to files with specific extensions in ASP.NET?

查看:94
本文介绍了如何限制对文件的访问,在ASP.NET特定扩展?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的web应用程序的ADO.NET实体框架* .edmx文件。

I have in my web application an ADO.NET Entity-Framework *.edmx file.

当我浏览的浏览器(应用程序运行时)到EDMX文件,它不会显示在浏览到一个* .cs或VB文件时一样的错误页面,打开EDMX并显示我的模型方案为所有用户!

When I browse in the browser (when the application is running) to an edmx file, it doesn't show the error page like when browsing to a *.cs or vb file, it opens the edmx and shows my model scheme to all the users!!!

我怎样才能避免这种情况。

How can I avoid that.

推荐答案

您可以这样做两种方式;首先在web.config或其次在IIS

You can do this two ways; firstly in the web.config or secondly in IIS

<system.web>
    <httpHandlers>
        <add verb="*" path="*.edmx" type="System.Web.HttpForbiddenHandler" />
    </httpHandlers>
</system.web>

下面是到Microsoft支持页面,详细说明如何做到这一点在网络配置和IIS的链接。

Here's a link to a microsoft support page that details how to do it in the web config and IIS.

http://support.microsoft.com/kb/815152

这篇关于如何限制对文件的访问,在ASP.NET特定扩展?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆