get page name
-
hello how can get pae name from URL as this http://www.any.com/abc.aspx?ss=4 i want the result to be abc.aspx ????
Palestine
-
hello how can get pae name from URL as this http://www.any.com/abc.aspx?ss=4 i want the result to be abc.aspx ????
Palestine
would that be everything ending at the first question mark, and starting after the last slash before it ? the string class has everything you need. :)
Luc Pattyn
try { [Search CP Articles] [Search CP Forums] [Forum Guidelines] [My Articles] } catch { [Google] }
-
would that be everything ending at the first question mark, and starting after the last slash before it ? the string class has everything you need. :)
Luc Pattyn
try { [Search CP Articles] [Search CP Forums] [Forum Guidelines] [My Articles] } catch { [Google] }
I'd rather use the Request object and its methods to access the different parts of the URL that do it myself with string operations. see MSDN HttpRequest class for more information.
-^-^-^-^-^- no risk no funk
-
hello how can get pae name from URL as this http://www.any.com/abc.aspx?ss=4 i want the result to be abc.aspx ????
Palestine
Uri mine=new Uri("http://www.any.com/abc.aspx?ss=4"); string path=mine.AbsolutePath //result would be like '/abs.aspx' just for this page //you can use string operations with string class or regex for above result or use the simpler way like the code below string name=mine.Segments[mine.Segments.Length-1]; // just give you the last part of the name
-
Uri mine=new Uri("http://www.any.com/abc.aspx?ss=4"); string path=mine.AbsolutePath //result would be like '/abs.aspx' just for this page //you can use string operations with string class or regex for above result or use the simpler way like the code below string name=mine.Segments[mine.Segments.Length-1]; // just give you the last part of the name
how can get the URL from asp.net page ??
Palestine
-
how can get the URL from asp.net page ??
Palestine
if you mean getting the url of current page you can use
Uri pageUri=Request.Url;
if you need mapping or rewriting for url see: http://www.codeproject.com/aspnet/urlrewriter.asp http://www.simple-talk.com/dotnet/asp.net/a-complete-url-rewriting-solution-for-asp.net-2.0/