【问题标题】:MasterPage.Master > Which page will be next loaded as a child?MasterPage.Master > 下一个页面将作为子页面加载?
【发布时间】:2011-03-17 07:48:42
【问题描述】:

我想知道,在我的MasterPage.MasterPage Load 事件中,哪个页面发送了请求。 将作为子内容加载。

假设,用户点击我的网页<a href="Login.aspx">Login</a>,我可以从我的MasterPage.MasterPage Load 事件中获取该值以供以后处理吗?

Dim ThePageThatWillLoadAsChildIs as string =

你看我想使用它,所以当请求页面是 e.x. login.aspx,在我网页的表单元素中注入一些属性。

【问题讨论】:

  • 我觉得这里有个小误会。您想要点击链接的页面还是正在加载的页面?推荐人还是目标?
  • @Elad Lachmi 我需要目标。超链接 Login 实际上存在于 MasterPage.Master
  • 那你需要使用 citronas` 方法。我的回答是考虑您想知道点击的来源,而不是当前请求的页面。顺便说一句:如果 URL 不同,这将起作用。如果请求相同的物理 aspx 文件名,您可能需要使用查询字符串。

标签: asp.net httpwebrequest master-pages master-detail


【解决方案1】:

查看 Request.Url 属性并在那里获取必要的信息

【讨论】:

  • @Chocol8:我的回答告诉你如何访问当前浏览的页面
【解决方案2】:

我认为您正在寻找的是 Request.UrlReferrer

【讨论】:

    【解决方案3】:

    这个可以解决问题(在母版页加载时)

    Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
       Dim TheNextPageThatWillLoad As String = DirectCast(sender, MasterPage).Request.RawUrl
    End Sub
    

    【讨论】:

      猜你喜欢
      • 2014-04-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-17
      • 1970-01-01
      相关资源
      最近更新 更多