Sometimes we need to get the physical name (from the bar adress of url) of an asp.net page to pass it by value or to loop throw project pages programmatically.
In that purpose we use a function to split the URL's string
and then get the whole Url and use our function that extract just the name of the page with its extension(.aspx)
In that purpose we use a function to split the URL's string
Public Function cutString(ByVal url As String) As String Dim St1() As String St1 = Split(url, "/") For i = 0 To UBound(St1) cutString = St1(i) Next i cutString = St1(UBound(St1)) End Functionand then get the whole Url and use our function that extract just the name of the page with its extension(.aspx)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Textbox1.Text= cutString(Request.Url.ToString)
End Sub
No comments:
Post a Comment