Home > database >  Get url of current page from modal popup
Get url of current page from modal popup

Time:12-30

On one page when user click on button then I am opening one popup.

Now user will fill the form and click on submit so data will be saved in db and page need to refresh.

Data is saving successfully now as I need to refresh page again, so I am trying to get url of that page.

string Url = string.Format("{0}://{1}{2}{3}", HttpContext.Request.Scheme, HttpContext.Request.Host, HttpContext.Request.Path, HttpContext.Request.QueryString);

But every time I am getting URL of that popup submit form, while I want to get main url which is browser in page.

So any idea how can I get that URL.

CodePudding user response:

you can use this method:

var url1 = HttpContext.Request.Host;
var url2 = HttpContext.Request.Path;
var url = url1   url2;

enter image description here

  • Related