<h2>Complete Web Page URL <br /></h2>
<asp:Label ID="lblMessage" runat="server"></asp:Label>
<h3>Web Page Name :- </h3>
<asp:Label ID="lblPageName" runat="server"></asp:Label>
C# code :
string url = HttpContext.Current.Request.Url.AbsoluteUri;
lblMessage.Text = url;
string[] urlArr = url.Split('/');
string[] pageName = urlArr[urlArr.Length - 1].Split('.');
lblPageName.Text = pageName[0];
Output:-
<asp:Label ID="lblMessage" runat="server"></asp:Label>
<h3>Web Page Name :- </h3>
<asp:Label ID="lblPageName" runat="server"></asp:Label>
C# code :
string url = HttpContext.Current.Request.Url.AbsoluteUri;
lblMessage.Text = url;
string[] urlArr = url.Split('/');
string[] pageName = urlArr[urlArr.Length - 1].Split('.');
lblPageName.Text = pageName[0];
Output:-
No comments:
Post a Comment