【发布时间】:2014-03-19 05:58:32
【问题描述】:
我正在尝试在 url (localhost/fca/htp/home.aspx) 中捕获页面名称。这是第一次。第一次加载页面时 indexofdot 取值为 4 ,即主页。但是当页面刷新或者当我们在访问其他页面后再次返回主页时,它的值是 5,这是错误的。我尝试 page.ispostback 在刷新时跳过,但它不起作用。 提前谢谢你
If String.IsNullOrEmpty(PageName) Then 'Probably the home page
Dim PathComponents As String() = Request.FilePath.Split("/")
Dim indexOfDot As Integer = PathComponents(PathComponents.Length - 1).IndexOf(".")
If indexOfDot > -1 Then
PageName = PathComponents(PathComponents.Length - 1).Remove(indexOfDot)
End If
End If
【问题讨论】:
标签: vb.net-2010