1

I have a survey application which user fills the info and then clicks Submit and gets redirected to other page(Success.aspx) which simply shows a message "Survey was saved!"

After that I want to redirect user automatically to the login page. I found the following code:

<meta http-equiv="refresh" content="3;url=Login.aspx/" />

Above code "Does" work. User gets redirected to login.aspx after 3 seconds, however code does not break in Visual Studio(2013) anymore. If user tries to login, code directs him to the survey page Response.Redirect("Survey.aspx")

but the break point that I put in the load even of that page will no longer works.

If I remove

 <meta http-equiv="refresh" content="3;url=Login.aspx/" />

Breakpoints work again! Is this a known issue?

Liam
  • 27,717
  • 28
  • 128
  • 190
S Nash
  • 2,363
  • 3
  • 34
  • 64
  • What's the HTTP response code you get? Are you sure your browser isn't caching the response? – Liam May 11 '15 at 16:13
  • Not sure but the this behavior is exact cause of adding `` – S Nash May 11 '15 at 16:15
  • How to check the HTTP response? how to check if browser i caching? – S Nash May 11 '15 at 16:16
  • I'd advise installing [fiddler](http://www.telerik.com/fiddler) and inspecting the HTTP to get a better understaning of what is happening. I would bet the HTTP request has a cache header and the browser is serving it from it's cache and therefore not hitting the server/your instance of VS – Liam May 11 '15 at 16:16
  • 1
    As far as the server is concerned, they are two entirely independent requests. It's not even a redirect in any real sense. Does VS normally honor breakpoints like that? – cHao May 11 '15 at 16:17
  • @cHao: Yes, breakpoints will all hit if I remove `' – S Nash May 11 '15 at 16:19
  • @SNash: ...? Even the ones in `Login.aspx`? – cHao May 11 '15 at 16:20
  • After `` Breakpoints in the login.aspx are hit. But breakpoints in the Survey.aspx will no longer hit. – S Nash May 11 '15 at 16:22
  • So where are your breakpoints? In login.aspx or survey.aspx? – Liam May 11 '15 at 16:25
  • 1
    Both locations. the ones in login.aspx hit , the ones in survey do not get hit. – S Nash May 11 '15 at 16:27
  • 1
    Well in that case that is correct functionality. The redirect never sends a request to login.aspx, your thinking of postbacks, your not triggering a postback you're triggering a new request (to **login.aspx**) to a different page! Entirely different thing. You can't trigger a postback using a meta tag, you'd need to use javascript – Liam May 11 '15 at 16:29
  • 1
    Yes I, use Javascript and it works. – S Nash May 11 '15 at 16:55
  • 1
    I am still confused on why using – S Nash May 11 '15 at 16:57
  • 1
    @ Liam, based on your logic, breakpoints in the login.aspx also should not be hit. Or I am wrong? – S Nash May 11 '15 at 16:59
  • Yes, your wrong :) You need to understand the difference between a [postback](http://stackoverflow.com/questions/183254/what-is-a-postback) which ASP.Net does when you press a button and a [HTTP Request](http://rve.org.uk/dumprequest) which is what the meta tag is doing. – Liam May 12 '15 at 08:05
  • @Liam, put this as an answer and I will accept it. – S Nash May 15 '15 at 00:30

1 Answers1

1

You are getting confused between a ASP.Net postback and a classic HTTP Request (in this case a GET)

Only ASP.Net does a postback, this is a none standard interaction triggered by a __doPostback() JavaScript call that comes bundled into ASP.Net.

What the meta tag does is a standard HTTP GET.

The difference (in your particular scenario) is that the postback will hit the calling page when something happens (the client triggers a HTTP POST to the server and ASP.Net handles the call) where as the meta will simply trigger a GET to the new page (the client simply calls the new page and does not interact with the calling page)

Hope that explains it.

Community
  • 1
  • 1
Liam
  • 27,717
  • 28
  • 128
  • 190