分类目录归档:C#

CSharp

How To: Set the proxy for the WebBrowser control in .NET

Source:https://blogs.msdn.microsoft.com/jpsanders/2011/04/26/how-to-set-the-proxy-for-the-webbrowser-control-in-net/

I see some horrible solutions for this out on the web.  Most involve setting the proxy for the entire machine and then toggling it back off.  Here is a class that will allow you to set it ONLY FOR THE PROCESS that the control is hosted in.  You could call it like this:

WinInetInterop.SetConnectionProxy(“localhost:8888”);

and then restore it to the default set in IE with this call:

// read the default settings for IE and restore these as the proxy
WinInetInterop.RestoreSystemProxy();
Let me know if you thought this was useful! 继续阅读

WinForm应用程序自动升级实现

最近单位开发一个项目,其中需要用到自动升级功能。因为自动升级是一个比较常用的功能,可能会在很多程序中用到,于是,我就想写一个自动升级的组件,在应用程序中,只需要引用这个自动升级组件,并添加少量代码,即可实现自动升级功能。因为我们的程序中可能包含多个exe或者dll文件,所以要支持多文件的更新。 继续阅读

防止对 Visual Basic .NET 或 C# 代码进行反相工程

摘要

.NET 体系结构的优势之一在于,利用该体系结构构建的程序集包含很多有用的信息,使用中间语言反汇编程序 ILDASM 即可恢复这些信息。但是这样会带来另一个问题,就是可以访问您的二进制代码的人能够以非常近似的手段恢复原始源代码。作者将在文中介绍程序模糊处理,该处理可作为一种阻止反相工程的手段。此外,他们还将讨论可用的不同类型的模糊处理技术,并示范 Visual Studio .NET 2003 中包含的新模糊处理工具。 继续阅读

Some examples of scripting of IIS using ADSI, WMI from VB and C# including the new Microsoft.Web.Administration namespace

Below are some simple examples of how to talk to IIS via ADSI, WMI and the new IIS 7 only .NET Managed Provider.

The IIS ADSI Provider

The IIS ADSI provider exposes COM Automation objects that you can use within command-line scripts, ASP pages, or custom applications to change IIS configuration values stored in the IIS metabase. IIS ADSI objects can be accessed and manipulated by any language that supports automation, such as Microsoft® Visual Basic® Scripting Edition (VBScript), Microsoft JScript®, Perl, Microsoft Active Server Pages (ASP), Visual Basic, Java, or Microsoft C++.

继续阅读