尚书房书评第二站

推荐你看什么小说的博客

  博客园 :: 首页 :: 联系 :: 订阅 订阅 :: 管理
  9 Posts :: 0 Stories :: 3 Comments :: 0 Trackbacks

公告

2008年5月5日 #

做黑客是我的梦想,当然也攻陷了些网站,算个会使用工具的"黑客"。
故作神秘是我的向往,把自己的东西弄的很神秘,我想同好也应该有很多吧
把算法,公式放在DLL里就满足了你这个需求

这个在c# asp.net称为自定义控件

文件->新建项目->visual c#->windows->web控件库
位置自己设定下,名称也设定下
代码

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebCL1
{
    [DefaultProperty(
"Text")]
    [ToolboxData(
"<{0}:WebCustomControl1 runat=server></{0}:WebCustomControl1>")]
    
public class WebCustomControl1 : WebControl
    
{
        [Bindable(
true)]
        [Category(
"Appearance")]
        [DefaultValue(
"")]
        [Localizable(
true)]
        
public string Text
        
{
            
get
            
{
                String s 
= (String)ViewState["Text"];
                
return ((s == null? String.Empty : s);
            }


            
set
            
{
                ViewState[
"Text"= value;
            }

        }


        
protected override void RenderContents(HtmlTextWriter output)
        
{
            output.Write(
"测试:"+Text);
        }

    }

}


 

生成->WebCL1
提示:WebCL1 -> E:\netweb\webcontrol\WebCL1\WebCL1\bin\Debug\WebCL1.dll
这样你的控件就生成完毕了,关闭这个工程
算了,怕我说的不清楚,还是我用图示下过程吧

新建->网站->asp.net c# 文件系统
添加刚才生成的DLL
E:\netweb\WebSite1(这个是你的目录,随便写)

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register TagPrefix="MyDLL" Namespace="WebCL1"  Assembly="WebCL1" %>>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    
<title>无标题页</title>
</head>
<body>
    
<form id="form1" runat="server">
    
<div>
    
<MyDLL:WebCustomControl1 Text="jar.cnblogs.com" runat=server ID="WebCL1" />
    
</div>
    
</form>
</body>
</html>

下面把过程和结果都贴出来




完成了,后面都用图来代替,如果看不懂,请写信给我吧

nikeren@163.com

posted @ 2008-05-05 16:50 金明 阅读(123) 评论(0) 编辑