Link to home
Start Free TrialLog in
Avatar of ErikIce
ErikIce

asked on

timer redirect to hta from asp.net page

Hello,
I have the following:
ajax update panel. Inside it, there is an ajax timer.

In the Timer_tick there is a Response.Redirect("MyPage.hta")

The problem is that the timer fires only once. After the first response.redirect("MyPage.hta") no more Tick is fired.

The hta page is needed to run an exe file.

What am I doing wrong? Is there another way to do it?


Here my code:

<asp:UpdatePanel ID="updQuality" runat="server">
                        <Triggers>
                          <asp:AsyncPostBackTrigger ControlID="TimerQuality" EventName="Tick" />
                             </Triggers>
                             <ContentTemplate>
                                 <asp:Timer ID="TimerQuality" runat="server" ClientIDMode="Static" Interval="10000"  />

                                      <div>
                                         <asp:CheckBox ID="chkManageQualityAutomatic" runat="server"  Text="<%$ Resources:Dictionary, LABEL_10496%>" AutoPostBack="True" CssClass="chkManageQualityAutomatic" />
                                      </div>
                                      <div>
                                          <asp:Label ID="lblTime" runat="server" Text=""></asp:Label>
                                      </div>
                         
                                             
                             </ContentTemplate>
                         </asp:UpdatePanel>




        Protected Sub TimerQuality_Tick(sender As Object, e As System.EventArgs) Handles TimerQuality.Tick

               response.redirect("MyFile.hta")


        End Sub
Avatar of Rob
Rob
Flag of Australia image

seems like double handling to run an hta to execute an exe. Can you use the shell to run your exe as i think using response.redirect is causing an issue for you as it may not return a value to the update panel
Avatar of ErikIce
ErikIce

ASKER

Hi,
thaks for reply.
What do you mean as "double handing"?
And how can I use the shell to run an exe from browser?

Thanks
Sorry, does the exe need to run locally or on the server? If locally then the hta is applicable otherwise the server can run it
Avatar of ErikIce

ASKER

the exe has to run rocally. think for example that hta has to open notepad.exe ..
Ok that makes sense. Something isn't sitting right about this though and i can't out finger on it but I'll let you know if I think of it

You can confirm that the hta runs at least once right?

You're telling an AJAX response to redirect, which i think is where your issue lies. Does this need to be within an update panel?
Avatar of ErikIce

ASKER

yes, hts runs at least once.
No... I think that update panel is not needed, may be. I don't know if timer needs it.
Thanks
The timer doesn't have to be in an update panel, it will just trigger it to update if configured as such.  Outside the update panel it just becomes a trigger you can do whatever you like with.  I would suggest something more like a hidden iframe that points to the hta.
When your trigger goes off it will just refresh the iframe.
ASKER CERTIFIED SOLUTION
Avatar of ErikIce
ErikIce

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Excellent. Glad we got there in the end :-)
Avatar of ErikIce

ASKER

I've requested that this question be closed as follows:

Accepted answer: 0 points for ErikIce's comment #a39881951

for the following reason:

works..
see http:#a39878929.

The timer doesn't have to be in an update panel, it will just trigger it to update if configured as such.  Outside the update panel it just becomes a trigger you can do whatever you like with.
Avatar of ErikIce

ASKER

Hello, I'm very sorry, how can I mark MY POST as accepted solution?
I've found it by myself.. ... why does it is not Accepted Answer????
You did that's why I objected.  I said to move the time outside the panel and then use it as a trigger to run your hta.  How is that not helping you get your answer?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ok my bad. I'll start the close process again but thanks for clarifying