不用VS.Net生成Web项目时,如何在.aspx文件中添加引用?

大可山人
博客专家认证
2004-03-05 08:11:00
Apply XSLT Transformation by Using MSXML
Paste the following code in Notepad or another text editor, and then save the file as Msxml.xslt:<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:user="http://my_domain_name/my_namespace">

<msxsl:script language="VBScript" implements-prefix="user">
Function ConvertDate(nodeList)
ConvertDate = FormatDateTime( Left(nodeList(0).text, 10),1)
End Function
</msxsl:script>

<xsl:template match="/">
<xsl:value-of select="user:ConvertDate(data)"/>
</xsl:template>

</xsl:stylesheet>
Create a new ASP.NET Web Application project named DateTimeMSXml by using Visual C# .NET.
On the Project menu, click Add Reference.
On the COM tab, select Microsoft XML, v3.0. //这里怎么在aspx页面中添加引用?
Click Select, and then click OK .
Right-click the designer surface of WebForm1.aspx, and then click View Code to edit the WebForm1.aspx.cs class module.
Paste the following code in the Page_Load event:MSXML2.DOMDocument doc = new MSXML2.DOMDocumentClass();
doc.async = false;
doc.resolveExternals = false;
// Load XML document.
doc.load(this.MapPath("Q330602.xml"));

MSXML2.DOMDocument xsl = new MSXML2.DOMDocumentClass();
doc.async = false;
doc.resolveExternals = false;
// Load XSLT document.
xsl.load(this.MapPath("msxml.xslt"));
// Transform XML data.
string temp = doc.transformNode(xsl);
Response.Write(temp);
Save the changes to WebForm1.aspx.cs.
Make sure that the Q330602.xml and Msxml.xslt files are in the folder where the project is created.
On the Build menu, click Build Solution.
Start Internet Explorer and open the WebForm1.aspx file. To do this, specify the following URL, where IISServerName is the name of your IIS server: http://IISServerName/DateTimeXSLT/WebForm1.aspx

VS.Net生成太多的垃圾代码,如何直接在.aspx页面中添加COM引用?
...全文
128 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
minghui000 2004-04-01
  • 打赏
  • 举报
回复
123
qynum123 2004-03-31
  • 打赏
  • 举报
回复
将你的源代码文件编译成dll,放到你的项目的bin目录下,在程序引入:<% Import NameSpace="yourNameSpace",源文件中必须是声明namespace,在namespace中再包括自己的类,一个namespace中可以包括多个类!
例如:
using System.Data;
using System;
namespace yourNameSapce
{
class A
{
.....
}
class B
{
....
}
}
darkzhan 2004-03-31
  • 打赏
  • 举报
回复
用 import namespace
大可山人 2004-03-31
  • 打赏
  • 举报
回复
顶。
meixiaofeng 2004-03-30
  • 打赏
  • 举报
回复
UP

62,243

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧