Winform webpage call (. NET egg Security Policy)

Source: Internet
Author: User

The Course Project is a B/S-based data management platform. After logging on to the website, you can view data on the webpage. The data is displayed on the webpage as a bar chart. At first, this project was used. the Net Framework 2.0 Framework was compiled and later upgraded to 3.5. One problem in the project is that some Windows systems cannot view its webpage, such as xp. The specific cause is unclear... Last year, Microsoft upgraded the. NET version to 4.0. The teacher wanted us to use the 4.0 framework for compilation and solve the problem that some systems could not be called on webpages.

. Net has a very powerful place, that is, its winform control can be conveniently called on the webpage, unlike the local registration of COM components, there are many examples of embedding the winform control into a web page. After IIS is configured, place the DLL file of the control in the virtual IIS directory, and then compile an HTML add OBJECT tag for calling. However, we are unable to call this function in this system. We have found a lot of information on the Internet.. Net Security Policy.. net uses the lowest security by default.. Net Security. net Framework configuration. Although it is based on 2.0, it still supports 3.0 and 3.5, because before 3.5. net uses clr2.0, while 4.0 uses clr4.0. download it.. NET Framework configuration 2.0 and later. Open it in Control Panel and management tools. NET 2.0 Configuration tool, see:

Click "run database security policy" to change the security. net permission to the maximum, do not forget to add the website we want to visit to the trusted website after the configuration is complete, finally we open the page in IE, found that the success of the bar chart.

After solving this problem, we need to re-compile the program under the 4.0 framework. As expected, the web page cannot be displayed again. The reason is that 4.0 has changed the traditional security mechanism, which is more advanced than ever before. The policy section of code access security (CAS) has been abandoned, and the default permission cannot be changed by using configuration tools, to enable the old CAS policy, you must. add the following code to the config file:

<Configuration>

<Runtime>

<Netfx40_legacysecuritypolicy enabled = "true"/>

</Runtime>

</Configuration>

Compile and generate a new version in the 4.0 framework.

Another troublesome method is to package the. Net control into an ActiveX control and release the installation program. Then, the client installs the control and then calls it on the webpage... This method is certainly correct, because ActiveX components have already been registered locally, but the need to install and register locally cannot be compared with. NET components.

Finally, we use oleview to check that after local installation, we found the control we installed under the. NET () node, followed by its CLSID and other information. The method mentioned above does not have the component information locally.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.