禁用asp.net中的视图源 [英] disable view source in asp.net

查看:63
本文介绍了禁用asp.net中的视图源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在asp.net中的浏览器中禁用视图源请任何人帮助我...............

解决方案

< blockquote>

这不完全是一个ASP.NET问题,但我会尝试回答。首先,您必须知道您无法绝对保护页面的来源。无论你做什么,任何坚定的黑客都能够得到它。如果浏览器可以访问它来呈现它,任何人都可以这样做。 

要禁用右键单击按钮,您只需处理onmousedown事件:

< body onmousedown = if((event.button | 2)!= 0){alert('右键禁用');} >




你不能,这是不可能的。这与ASP.Net无关。



您的服务器将响应发送回发出请求的客户端(例如Web浏览器),浏览器的工作是解释和呈现HTML。



这不只是'查看来源'的案例



想想所有的网页开发人员插件Firefox(即Firebug)和Chrome + IE的内置工具,可让您查看页面的各个方面。



他们将您的页面分解为单个组件(图像,CSS,脚本等),最终用户可以看到有关您页面的所有内容!你不能禁用这些。



所以,不是简短的回答。无论你是否有要求都没关系,


这样的问题很重复,这很棒;看到这个讨论:

如何从asp.net中的aspx页面隐藏css文件和javascript文件 [ ^ ]。



OP想要隐藏CSS和Javascript,但这是一回事。



-SA


how can i disable view source in browsers in asp.net please any one help me...............

解决方案

That's not exactly an ASP.NET question, but I'll try to answer. First, you have to know that there is no way you can absolutely protect the source of your page. Any determined hacker will be able to get to it no matter what you do. If the browser can access it to render it, anyone can do it.

To disable the right click button, you just need to handle the onmousedown event:

<body onmousedown="if((event.button|2)!=0){alert('Right button disabled');}">



You can't, it's impossible. It's nothing to do with ASP.Net.

Your servers send a response back to the client that made the request (e.g. the web browser), it's the job of the browser to interpret and render the HTML.

It's not just a case of 'view source'

Think about all the web developer plugins for Firefox (i.e Firebug) and the built in tools to Chrome + IE that let you view every aspect of the page.

They break your page down into individual components (images, css, scripts, etc) and the end user can see everything about your page! You can't disable these.

So, no is the short answer. Doesn't matter if you have a requirement or not,


It's wonderful that questions like this are repeated; see this discussion:
how can hide css file and javascript file from aspx page in asp.net[^].

OP wanted to hide CSS and Javascript, but this is the same thing.

—SA


这篇关于禁用asp.net中的视图源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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