Online CPU Console using a Web Control Library wit

<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 728x15, 创建于 08-4-23MSDN */ google_ad_slot = "3624277373"; google_ad_width = 728; google_ad_height = 15; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 160x600, 创建于 08-4-23MSDN */ google_ad_slot = "4367022601"; google_ad_width = 160; google_ad_height = 600; //--> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
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.<
11AJ3b25015E3.jpg
seover="window.status='正文--Online CPU Console using a Web Control Library with .NET Security(3)';return true">
<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 728x15, 创建于 08-4-23MSDN */ google_ad_slot = "3624277373"; google_ad_width = 728; google_ad_height = 15; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 160x600, 创建于 08-4-23MSDN */ google_ad_slot = "4367022601"; google_ad_width = 160; google_ad_height = 600; //--> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
阅读更多
个人分类: .net
想对作者说点什么? 我来说一句

adaptive_MPC_Control

2018年05月13日 10KB 下载

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭