如何防止用户替换全局缓存程序集或更改时显示错误? [英] How to prevent the user to replace global cache assembly or show error if changed?

查看:72
本文介绍了如何防止用户替换全局缓存程序集或更改时显示错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,

我创建了一个强名命的程序集,我安装在全局程序集缓存中。

然后我在我的应用程序中添加了作为参考。结果很成功。之后,我创建了一个具有相同名称且没有强名称的程序集,并从全局缓存中手动删除了现有程序集,并替换为新创建的程序集(没有强名称)。我替换申请工作正常。



我的问题:

申请将不允许其他组装。如果某个替换为其他程序集应用程序的人不应该运行,我怎么能实现呢?

Dear All,
I have created one strongly named assembly and I installed in global assembly cache.
Then I added as a reference in my application. That results successful. After that I have created one assembly with same name and without strong name and manually deleted existing assembly from global cache and replaced with newly created assembly(without strong name). After I replaced application working fine.

My Question:
Application won't allow other assembly. if some one replaced with other assembly application should not run, how can I achieve that?

推荐答案

除了你得到的有价值的评论 - 但忽略了 - 它可能是有趣的你对这个强名之物概念的问题是什么?

这个强大的名字阻止你在GAC中发生名称冲突 - 仅此而已。

如果你手动删除它,你必须看到在这个特殊的文件夹中发生了什么 - 创建了一个具有强名称的目录,并将你的dll放入其中。

因此,强大的名称不是GAC的任何安全机制。

(你甚至可以替换.NET dll - 如果你替换mscorlib会很有趣。你的同事计算机上的dll)。



结论:保护你的Windows系统 - 如果有人可以替换你的GAC中的dll,你就已经容易受到各种坏事的攻击...



只是我的2cents ...
In addition to the valueable comments you got - but ignored - it maybe interests you what's the problem in your conception of this "strong name thing" is.
The strong name stops you from having name collisions in the GAC - nothing more.
If you deleted it manually you must have seen what happens in this special "folder" - a directory with the strong name is created and your dll is put into it.
So a strong name is not a "security mechanism" in any way regarding the GAC.
(you can even replace .NET dll's - much fun if you replace mscorlib.dll on your coworkers computer).

Conclusion: Protect your Windows-System - if someone can replace dll's in your GAC you are allready vulnerable to all kind of "bad things"...

just my 2cents...


简单,监控GAC目录(是的,有一个),如果有任何文件改变,就会抛出一个错误。



话虽如此,这是浪费编程,改为使用域策略。
Easy, monitor the GAC directory(yes there is one), if any files change, throw an error.

That being said, this is a waste of programming, use domain policy instead.


这篇关于如何防止用户替换全局缓存程序集或更改时显示错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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