Re: Response.redirect inside a Timer Event

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Many thanks for your gelp Mark, but I afraid that it doesn't work.

It is even more complecated, I'll try to give you all details:

1.) I have a masterpage with a contentplaceholder.
2.) The contentplaceholder is an .aspx with a <IFRAME> tag (i.e page1.aspx)
3.) The <IFRAME> source is to another .aspx (i.e. page2.aspx)
4.) In OnLoad Event of page2.aspx is built a Form in runtime and it is
submited automatically. The Action of this form connect to an external page.

So, when I see the sourcecode, I see the request to the form submit, that
is, I have no control to this page. The URL is page2.aspx, but the sourcecode
is the request to the form submited.

After the form is submited to an external page, is processed there and if it
is ok, it will insert a value on a database.

Meanwhile, I have to be waiting for this value, but only I have control of
page1.aspx and MasterPage. Then, when the value is inserted I have to
redirect to another page, for that, I was using a timer.

I can't use OnLoad on page2.aspx, because when the form is submited, the
code is rewritten for the external server, so the meta tag disappear and I
can't write any code because I have no control of that.

Do you understand what I mean?


"Mark Rae [MVP]" wrote:

"albertosoria" <albertosoria@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:986290F3-AE69-4A37-82DC-B693BF1AB955@xxxxxxxxxxxxxxxx

I'll try to explain you what I want to do.

I have an .aspx page with an <IFRAME> tag inside. The Source attribute of
this tag connect to an external server and this server will insert a value
in
a database.

I need to wait until this value appear, but I don't know when it will
happen
(but I'm sure it will), so I use the timer to search in the database each
five seconds, and when I get to catch the value, I have to do the
response.redirect, not before.

Firstly, you didn't mention any of the above in your original post...

Any idea how can I do that?

1) Forget the server-side timer approach

2) Set the page inside the iframe to refresh itself using the meta tag

3) Add the following to the Page_Load of the page inside the iframe:

protected void Page_Load(object sender, EventArgs e)
{
bool blnValueExists = <however you check your database for this value);

if (blnValueExists)
{
ClientScript.RegisterStartupScript(GetType(), "redirect",
"parent.location.href='page2.aspx';");
}
}


--
Mark Rae
ASP.NET MVP
http://www.markrae.net


.



Relevant Pages

  • Re: UTF-8 and question marks
    ... I set content type to UTF-8 using META tag. ... In response header the ... But if I read a string from database and try to echo it I get ...
    (comp.lang.php)
  • Dynamic Titles and Meta Descriptions
    ... I am trying to create dynamic title and meta tag descriptions for my pages ... that are called from a database. ... Shot in the dark. ... db connection and all that. ...
    (microsoft.public.frontpage.programming)