- 热门文章:
- · Online CPU Console using a Web Control Library with .NET Security(2)
- · Online CPU Console using a Web Control Library with .NET Security(1)
- · 实现由web.config控制的验证
- · Passport 你的网站(在你的WebSite上实现MS Passport )上
- · Passport 你的网站(在你的WebSite上实现MS Passport )下
- · 利用ASP.NET来访问Excel文档
- · 如何把存储在数据库中的图片根据自己的需要的大小显示出来。【转】
- · Office XP Charting Examples in asp.net
- · 自定义控件的使用二----DBGlobal.cs部分
- · 自定义控件的使用例子一
- · 任意在datagrid里面添加控件。
- · 三、ASPNET中实现在线用户检测(使用后台守护线程)
上一篇:session 和 viewstate 的比较 >>
Online CPU Console using a Web Control Library with .NET Security(3)
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.
相关文章:
- · 二、ASPNET中实现在线用户检测(使用后台守护线程)
- · ASPNET中实现在线用户检测(使用后台守护线程)
- · 通过自定义类来达到向aspx页面加入脚本代码的例子
- · 一个实现自动求和/合并单元格/排序的DataGrid
- · WINDOWS2000服务器账号登陆身份验证
- · .NET中带有口令加密的注册页面(还是发表在这里吧~-~)
- · .NET中带有口令加密的注册页面
- · ASP.NET验证控件祥解(转)
- · 改写我前面的即时消息的发送,包含同时给多人发送信息!
- · 利用.net来发送即时消息:)
- · 个性化查询(具有分类模糊查询、换页等功能)
- · .net中即时消息发送的实现……
- · 用vb.net做的校友录……(附所有源代码)
- · web.config一个中文解释
- · Application事件的执行顺序
- · asp.net中当服务器出错时显示指定的错误页面,同时把错误信息写入系统日志文件的探讨
- · 完整的网站间共享数据的WebService(Love.NET原创)
- · HOW TO: Create an Assembly with a Strong Name
- · 图象显示和翻转控件(用户自定义控件)--我也来凑凑热闹--(转)
- · web组件的通信---浅谈事件
- · Using DropDownList control in DataGrid
- · KW大师精品文章赏析
- · 实现一个客户端的DataSet-----index.htm
- · 实现一个客户端的DataSet-----ClientDataSetDataProvider.asmx.cs(1)
- · 实现一个客户端的DataSet-----ClientDataSetDataProvider.asmx.cs(2)
- · 实现一个客户端的DataSet-----ClientDataSet.htc
- · 安装framework以后出现不能显示aspx页面,提示用户名和密码不匹配问题的解决(chicken修改补充)
- · IIS5 HTTP500内部错误解决办法(转自eNet)------(一)
- · IIS5 HTTP500内部错误解决办法(转自eNet)------(二)
- · IIS5 HTTP500内部错误解决办法(转自eNet)-------(三)
- · page_Load和page_Init的区别
- · 关于如何添加一个自增的列【原创】
- · 获得存储过程返回值的方法(return的值)
- · 关于返回前面的页面。如何两者兼得,自问自答
- · 在ASP.NET中的变量数值管理------看了这个我基本上对原来的REQUEST.FORM的方法传递变量绝望了
- · XML技术上传文件-转贴
- · 在datagrid中的HyperLinkColumn上达到谈出一个窗口的效果
- · 再datagrid中使用droplist。。。。重要的是其中的几个用法
