internal static string
GetURLName()
{
Uri uri = HttpContext.Current.Request.Url;
return
uri.Segments[uri.Segments.Length - 1].ToLower();
internal static string
GetPreviousURLName()
{
Uri uri = HttpContext.Current.Request.UrlReferrer;
return uri != null ? uri.Segments[uri.Segments.Length -
1].ToLower() : string.Empty;
internal static string
GetURLFileName()
{
Uri uri = HttpContext.Current.Request.Url;
return
uri.Segments[uri.Segments.Length - 1].ToLower().Replace(".aspx", string.Empty);
internal static bool
InValidPage(string pageName)
{
return GetURLName()
!= pageName;
Thanks for reading this article. Have a nice day.