009-程序集路径Web窗体

 1 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="t1_HelloWorld.Index" %>
 2 <%@ Import Namespace="System.Reflection" %>
 3 
 4 <!DOCTYPE html>
 5 
 6 <html xmlns="http://www.w3.org/1999/xhtml">
 7 <head runat="server">
 8 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
 9     <title></title>
10 </head>
11 <body>
12     <form id="form1" runat="server">
13     <div>
14         <%=Path1 %>
15     <hr/>
16         <%=Assembly.GetExecutingAssembly().Location%>
17     </div>
18     </form>
19 </body>
20 </html>
1     public partial class Index : System.Web.UI.Page
2     {
3         protected string Path1 { get; set; }
4         protected void Page_Load(object sender, EventArgs e)
5         {
6             Path1=Assembly.GetExecutingAssembly().Location;
7             Response.Write("Hello World");
8         }
9     }
原文地址:https://www.cnblogs.com/ninghongkun/p/6285808.html