page_load c#上的URL参数>

问题描述 投票:0回答:1

是否可以在page_load上设置URL参数?

例如,如果我在这样的代码中定义了一些字符串值:

string firstname =“ John”字符串姓氏=“ doe”

所以当我运行应用程序时,我希望URL直接像localhost:/webform.aspx?firstname = john&lastname =“ doe”。

是否可以在page_load上设置URL参数?例如,如果我在这样的代码中定义了一些字符串值:string firstname =“ John” string lastname =“ doe”那么当我运行...

c# asp.net url-parameters pageload
1个回答
0
投票

如果从应用程序中的某个位置(例如default.aspx)重定向到webform.aspx,则可以在default.aspx.cs中的相应方法中设置这些参数。如果您已经在webform.aspx的page_load中,则可以确保使用其他URL参数重定向到webform.aspx,但这可能会在访问您的Web应用程序的Web客户端与提供您的Web应用程序的服务器之间创建不必要的流量。

© www.soinside.com 2019 - 2024. All rights reserved.