c# - Getting name of Page being requested/was requested -


this question has answer here:

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

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -