建完了类,要进入配置文件进行配置
因为我这里是放在一个文件夹下面了,所以配置文件指定type的时候,要加一个文件夹的路径

<system.webServer> <modules> <add name="Module" type="WebApplication1.Modules.DeptModule"/> </modules> </system.webServer>
显示的web窗体
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DeptDetail.aspx.cs" Inherits="WebApplication1.DeptDetail" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title></title> </head> <body> <form id="form1" runat="server"> <div> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> </div> </form> </body> </html>
显示的web窗体的后台代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication1
{
public partial class DeptDetail : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//直接通过request获取Module存入的id
this.TextBox1.Text = $"{Request.QueryString["deptid"]}";
}
}
}
}
效果图
选择一个后点击查询

地址栏和内容都进行了更改

到此这篇关于ASP.NET通过更改Url进行页面传值的文章就介绍到这了,更多相关asp.net url 页面传值内容请搜索易采站长站以前的文章或继续浏览下面的相关文章希望大家以后多多支持易采站长站!








