惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - Franky
WordPress大学
WordPress大学
Hugging Face - Blog
Hugging Face - Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
小众软件
小众软件
人人都是产品经理
人人都是产品经理
罗磊的独立博客
博客园 - 聂微东
雷峰网
雷峰网
量子位
美团技术团队
V
V2EX
The GitHub Blog
The GitHub Blog
大猫的无限游戏
大猫的无限游戏
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
IT之家
IT之家
The Cloudflare Blog
爱范儿
爱范儿
T
Tailwind CSS Blog
博客园 - 三生石上(FineUI控件)
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
宝玉的分享
宝玉的分享
Last Week in AI
Last Week in AI
Jina AI
Jina AI

博客园 - Ivan Zou

示例 - 17行代码实现一个简单高效的多线程蜘蛛程序 示例 - 10行代码在C#中获取页面元素布局信息 Spider Studio 新版本 (20140225) - 设置菜单调整 / 提供JQueryContext布局相关的方法 示例 - 如何在NodeJS中调用SS生成的DLL 示例 - 25行代码等价实现 - 借助Nodejs在服务端使用jQuery采集17173游戏排行信息 Spider Studio 新版本 (码年吉祥版) - 浏览器视图 / 脚本库上线! 分享: 利用Readability解决网页正文提取问题 分享一个天气历史数据的采集脚本 分享 - Hybrid 开发将博客园集成到自己的网站中 - 效果高大上 :) Spider Studio 新版本 (20140109) - 修复浏览器对部分网页不支持的BUG Spider Studio 新版本 (20140108) - 优化设置菜单 / 生成程序集支持版本号 示例 - 数据仓库的妙用 Spider Studio 界面功能布局 C# 脚本代码自动登录淘宝获取用户信息 API - 使用数据仓库 - 基础篇 示例 - 如何在多线程中应用SpiderStudio生成的DLL? 示例 - 如何在Console应用程序中应用SpiderStudio生成的DLL? C#中另辟蹊径解决JSON / XML互转的问题 Spider Studio 新版本 (x-mas) - 可以引入第三方程序集, 可以将脚本生成为DLL
示例 - 如何在ASP.NET中应用Spider Studio生成的DLL?
Ivan Zou · 2013-12-26 · via 博客园 - Ivan Zou

>> 接前文 "示例 - 如何在Console应用程序中应用SpiderStudio生成的DLL?", 将其运用到ASP.NET中:

1. 创建WebApplication项目, 引入www.utilities_online.info.XmlJsonConverter.dll

2. 设置Target Framework为: .NET Framework 4

3. 在Default.aspx上拖放控件

HTML:

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" AspCompat="true" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <table>
    <tr><td>XML</td><td></td><td>JSON</td></tr>
        <tr>
            <td>
                <input id="xml" style="width:445px;height:320px" type="text" runat=server/>
            </td>
            <td>
                <asp:Button ID="toxml" runat="server" Text="&lt;-" onclick="toxml_Click" />
                <br />
                <asp:Button ID="tojson" runat="server" Text="-&gt;" onclick="tojson_Click" />
            </td>
            <td>
                <input id="json" style="width:445px;height:320px"  type="text" runat=server />
            </td>
        </tr>
    </table>
</asp:Content>

4. 将Default.aspx设置为: AspCompat="true"

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" AspCompat="true" %>

- 这样做的目的是将页面的线程模型改成单线程模式, 从而能够支持activeX控件的调用. 

5. 编写后台代码

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using www.utilities_online.info;

namespace WebApplication1
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected void toxml_Click(object sender, EventArgs e)
        {
            xml.Value = new XmlJsonConverter().Json2Xml(json.Value);
        }

        protected void tojson_Click(object sender, EventArgs e)
        {
            json.Value = new XmlJsonConverter().Xml2Json(xml.Value);
        }
    }
}

6. 运行~!

相关阅读: