3

I have a page with a button that if clicked on it, a function is called that creates a pdf and it is opened in a new tab. Now after clicking this button, I want to reload the current page then pdf file open in a new window. How can I do this action without change request url?

I try to use below code but it change the url of new tab:

if (Request.UrlReferrer != null) Response.Redirect(Request.UrlReferrer.ToString());

negin motalebi
  • 351
  • 2
  • 15

2 Answers2

1

I think you can use a simple JavaScript to reload current page completely

Have a look at this answer:

How to reload a page using JavaScript

Nguyễn Văn Phong
  • 13,506
  • 17
  • 39
  • 56
Mehdi Payervand
  • 251
  • 3
  • 11
  • thank you for your answer. but I can't do it in javascript code; because I do some action in controller and I want to reload after these actions. So I think it should be done in c# code. – negin motalebi Jan 18 '20 at 13:40
  • When you use ajax you should reload page in JavaScript, there is no way to reload. – Mehdi Payervand Jan 23 '20 at 18:45
0

You can use Request.UrlReferrer.ToString()

  • Thanks for your answer. I try it before but it change my current url that has been opened for show pdf and I don't want to change the request url – negin motalebi Jan 19 '20 at 08:13