Online CPU Console using a Web Control Library with .NET Security(3)

web

Call the event viewer control by the tag prefix colon and the class name of eventlog.cs. Note that we set a property from the query string in the code behind file.
Display vw_EventLog.aspx file
< !-- Register the WROXControlLib Assembly  -- >
<%@ Register TagPrefix="CPU" NameSpace="WROXCPUCONSOLE.ControlLib" Assembly="WROXControlLib" %>

<HTML>
  <BODY>
      <!-Call the Event Log Custom Control -->
      <CPU:EventLog id="eventlog1"
               runat="server"
               Machine="machine">
      </CPU:EventLog>
  </BODY>
<HTML>
Code Behind vw_EventLog.aspx.cs file
public class vw_EventLog : System.Web.UI.Page
{
   //Event Log Custom Control
   protected WROXCPUCONSOLE.ControlLib.eventlog eventlog1;

   private void Page_Load(object sender, System.EventArgs e)
   {
      //Set the machine property from the Query String
      eventlog1.Machine = Request.QueryString["machine"].ToString();
   }
}
Event Log Application Available in the Code Download
vw_Process.aspx
Call the process panel control by the tag prefix colon and the class name of process.cs. Note that we set a property from the query string in the code behind file.
Display vw_Process.aspx file
< !-- Register the WROXControlLib Assembly  -- >
<%@ Register TagPrefix="CPU" NameSpace="WROXCPUCONSOLE.ControlLib" Assembly="WROXControlLib" %>

<HTML>
  <BODY>
      <!-Call the Process Custom Control -->
      <CPU:PROCESS id="processes"
               runat="server"
               Machine="machine">
      </CPU:PROCESS>
  </BODY>
<HTML>
Code Behind vw_Process.aspx.cs file :
public class vw_Process : System.Web.UI.Page
{
   //Process Custom Control
   protected WROXCPUCONSOLE.ControlLib.process processes;

   private void Page_Load(object sender, System.EventArgs e)
   {
      //Set the machine property from the Query String
      processes.Machine = Request.QueryString["machine"].ToString();
   }
}
Process Panel Application Available in the Code Download
vw_Service.aspx
Call the service panel control by the tag prefix colon and the class name of services.cs. Note that we set a property from the query string in the code behind file.
Display .aspx file
< !-- Register the WROXControlLib Assembly  -- >
<%@ Register TagPrefix="CPU" NameSpace="WROXCPUCONSOLE.ControlLib" Assembly="WROXControlLib" %>

<HTML>
  <BODY>
      <!-Call the Service Custom Control -->
      <CPU:SERVICES id="service"
               runat="server"
               Machine="machine">
      </CPU:SERVICES>
  </BODY>
<HTML>
Code Behind .aspx.cs file:
public class vw_Service : System.Web.UI.Page
{
   //Service Custom Control
   protected WROXCPUCONSOLE.ControlLib.services service;

   private void Page_Load(object sender, System.EventArgs e)
   {
      //Set the machine property from the Query String
      service.Machine = Request.QueryString["machine"].ToString();
   }
}
Service Panel Application Available in the Code Download
Web.config
We tie the CPU Console together using the web.config file; here security is set for the entire application and any assemblies this application will execute. We impersonate the client's identity to call the assemblies, which in turn uses the client's identity to call the event log, processes, and services on any machine the user has access rights to. By setting the authentication type to Windows, ASP.NET will automatically retrieve the username and password when the user logs in. Web.config file should contain the following elements.
<configuration>
   <system.web>
      <authentication mode="Windows" />
      <identity impersonate="true" />   
   </system.web>
</configuration>
IIS Configuration
The final step is to configure IIS. In order to configure IIS correctly, and separate the release version and development versions, build the release version of our ASP.NET Web Application in the Program Files folder instead of the Inetpub folder.
Open Internet Services Manager, right-click on the default web site. Choose New | Virtual Directory. Click Next, and enter an alias, such as CPUConsoleApp (do not choose the same name of the ASP.NET Web Application). Browse to the ASP.NET Web Application that was moved out of inetpub\wwwroot. Click finish to complete the setup.
The new Virtual Directory will now be viewable; right-click and select properties. Click Directory Security | Edit. Uncheck all the boxes except for Basic Authentication, and click the Edit button besides Basic Authentication. Type a backslash ("\ ") in the Domain text area. The backslash allows users of the console to control multiple domains. Click OK on each of the three forms open to complete the configuration. Stop and start IIS to ensure proper configuration settings before viewing the application. Users must be in the group of administrators on the server and the machine they connect to.
IIS Authentication Configuration
The Web Application will be viewable by opening Internet Explorer and typing the following URL into the address bar.
http://localhost/VirtualDirectory/ASP/vw_Default.aspx
If IIS is configured correctly, there will be a prompt to log in before entering the web application. Use a Windows 2000 Account Domain\UserName for the User Name input, and the password of the account.
Login Prompt on Entrance of the Web Application
Conclusion
Our completed online CPU Console is a multi-tiered, robust, reusable application that is easily modifiable, and serves an important business purpose. In the downloadable code, connect to the vw_default.aspx web form in the ASP folder to allow the user to select a machine name.
By using the Online CPU Console, one can easily administer services, events and processes of any machine, even those machines that are not .NET framework enabled.
 

时间: 2024-10-04 22:52:46

Online CPU Console using a Web Control Library with .NET Security(3)的相关文章

Online CPU Console using a Web Control Library with .NET Security(1)

web ABSTRACTAdministering applications and servers when not connected to the network can be a nightmare, especially when only a few people manage the application. Just imagine going out for an evening on the town and then you're paged at one o'clock

Online CPU Console using a Web Control Library with .NET Security(2)

web WROXControlLibStep one is to set up a Web Control Library. Open Visual Studio .NET and choose a Web Control Library project. Add three new Custom Web Controls to the project named evenlog.cs, process.cs, and services.cs. Add System.ServiceProcess

Online CPU Console using a Web Control Library wit

WROXControlLibStep one is to set up a Web Control Library. Open Visual Studio .NET and choose a Web Control Library project. Add three new Custom Web Controls to the project named evenlog.cs, process.cs, and services.cs. Add System.ServiceProcess as

c#-Windows Forms Control Library of C#

问题描述 Windows Forms Control Library of C# VS 2013里面没有C#的Windows Forms Control Library 解决方案 我刚在我的VS2013里试过了,是可以找到 Windows Forms Control Library 这个模板的 解决方案二: wpf里面有 如果没有找到可以去网上下载 解决方案三: 有的,不过你要新建windows forms程序.另外,你需要安装完整版的vs,而不是visual studio express fo

wpf-WPF 看不到WPF control library 和 WPF custom class library 工程

问题描述 WPF 看不到WPF control library 和 WPF custom class library 工程 我的VS2010 怎么不能创建WPF control library 和 WPF custom class library

【更正】“给自定义控件(Web Control)添加事件的几种方法”有一个不太准确的地方。

    给自定义控件(Web Control)添加事件的几种方法.前两种方法可以不实现IPostBackEventHandler           上一篇写了一下如何在自定义控件里面添加事件,由简单的开始,一步一步实现了几种添加事件的方式,由于当时只给自定义控件添加了一种外部事件,测试的时候没有什么问题,但是后来在写分页控件的时候,我给分页控件加了两种外部事件,然后测试的时候就出现了一个问题,本来只想调用外部的一种事件,结果外部的两种事件都被调用了.分析了一下,public event Eve

A Complete ActiveX Web Control Tutorial

Download demo project - 231 Kb Introduction ActiveX is a Microsoft technology developed in the mid 90's, that allows for the creation of applet-like applications that can be downloaded and run within Microsoft's Web browser. This article is intended

把Web Control导出为Excel或Word

excel|web|word /// <summary> /// 将Web控件导出 /// </summary> /// <param name="source">控件实例</param> /// <param name="type">类型:Excel或Word</param> public void ExpertControl(System.Web.UI.Control source, Doc

在C#代码里使用IE WEB Control TreeView

treeview|web 网站目录下需要有Microsoft.Web.UI.WebControls.dll和相应的文件 如大家要转载,请保留本人的版权. /* *Description:完全的操作XML文件 *Auther:mingziweb_天很蓝 *Email:chongchong2008@msn.com *Dates:22004-09-10 *Copyright:ChongChong2008 YiChang HuBei China */ .aspx <%@ Register TagPref