c# - Getting name of Page being requested/was requested -
this question has answer here:
- how grab .aspx page name url? 7 answers
i know easy, i've forgotten how , since can't remember it's called; it's been difficult trying search solution.
how can request page name in c#?
e.g.:
string pagename = string.empty; if(ispost) { pagename = request.pagename; // example }
to make answer cleaner
public string getpagename() { string path = system.web.httpcontext.current.request.url.absolutepath; system.io.fileinfo info = new system.io.fileinfo(path); return info.name; }
Comments
Post a Comment