I've read a previous discussion about the same topic, but there's a
difference.
I call HttpContext.Cur rent.Response.R edirect("file.t xt") from a ownmade
sub in the global.asax.
That doesn't works, i'm quite new in asp.net and so i don't know what a
studip mistake i'm doing!!
here there's global asax code:
<%@ Application Language="VB" %>
<script runat="server">
Sub Application_Sta rt(ByVal sender As Object, ByVal e As EventArgs)
End Sub
Sub CreateTimer()
Dim myTimer As New System.Timers.T imer()
myTimer.Interva l = 3000
myTimer.Enabled = True
AddHandler myTimer.Elapsed , New
System.Timers.E lapsedEventHand ler(AddressOf Me.myTimer_Elap sed)
End Sub
Sub myTimer_Elapsed (ByVal sender As System.Object, ByVal e As
System.Timers.E lapsedEventArgs )
HttpContext.Cur rent.Response.R edirect("prova. txt")
End Sub
Sub Application_End (ByVal sender As Object, ByVal e As EventArgs)
End Sub
Sub Application_Err or(ByVal sender As Object, ByVal e As EventArgs)
End Sub
Sub Session_Start(B yVal sender As Object, ByVal e As EventArgs)
CreateTimer()
End Sub
Sub Session_End(ByV al sender As Object, ByVal e As EventArgs)
End Sub
</script> 5 6947
HTTP is all about Request and Response. A client makes a Request for a
resource, and the server responds with a Response. Without a Request, there
can be no Response.
An ASP.Net Page is a handler for a Request. A Timer_Elapsed event is not.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.
"Piz" <tw*******@yaho o.com> wrote in message
news:11******** *************@g 43g2000cwa.goog legroups.com... I've read a previous discussion about the same topic, but there's a difference. I call HttpContext.Cur rent.Response.R edirect("file.t xt") from a ownmade sub in the global.asax. That doesn't works, i'm quite new in asp.net and so i don't know what a studip mistake i'm doing!!
here there's global asax code: <%@ Application Language="VB" %>
<script runat="server">
Sub Application_Sta rt(ByVal sender As Object, ByVal e As EventArgs)
End Sub
Sub CreateTimer() Dim myTimer As New System.Timers.T imer() myTimer.Interva l = 3000 myTimer.Enabled = True
AddHandler myTimer.Elapsed , New System.Timers.E lapsedEventHand ler(AddressOf Me.myTimer_Elap sed) End Sub
Sub myTimer_Elapsed (ByVal sender As System.Object, ByVal e As System.Timers.E lapsedEventArgs )
HttpContext.Cur rent.Response.R edirect("prova. txt") End Sub
Sub Application_End (ByVal sender As Object, ByVal e As EventArgs)
End Sub
Sub Application_Err or(ByVal sender As Object, ByVal e As EventArgs)
End Sub
Sub Session_Start(B yVal sender As Object, ByVal e As EventArgs)
CreateTimer()
End Sub
Sub Session_End(ByV al sender As Object, ByVal e As EventArgs) End Sub
</script>
in general you ca not use a timer in asp.net (unless yuu add code to stall
page processing until the timer fires). in your case the timer has fired
after the page has been delivered to the browser. there is no one to see
the redirect command (which is just an html header).
-- bruce (sqlwork.com)
"Piz" <tw*******@yaho o.com> wrote in message
news:11******** *************@g 43g2000cwa.goog legroups.com... I've read a previous discussion about the same topic, but there's a difference. I call HttpContext.Cur rent.Response.R edirect("file.t xt") from a ownmade sub in the global.asax. That doesn't works, i'm quite new in asp.net and so i don't know what a studip mistake i'm doing!!
here there's global asax code: <%@ Application Language="VB" %>
<script runat="server">
Sub Application_Sta rt(ByVal sender As Object, ByVal e As EventArgs)
End Sub
Sub CreateTimer() Dim myTimer As New System.Timers.T imer() myTimer.Interva l = 3000 myTimer.Enabled = True
AddHandler myTimer.Elapsed , New System.Timers.E lapsedEventHand ler(AddressOf Me.myTimer_Elap sed) End Sub
Sub myTimer_Elapsed (ByVal sender As System.Object, ByVal e As System.Timers.E lapsedEventArgs )
HttpContext.Cur rent.Response.R edirect("prova. txt") End Sub
Sub Application_End (ByVal sender As Object, ByVal e As EventArgs)
End Sub
Sub Application_Err or(ByVal sender As Object, ByVal e As EventArgs)
End Sub
Sub Session_Start(B yVal sender As Object, ByVal e As EventArgs)
CreateTimer()
End Sub
Sub Session_End(ByV al sender As Object, ByVal e As EventArgs) End Sub
</script>
Explain rather what you are trying to do ? Someone will hopefully suggest
another approach (this one won't work as you'll send a response once the
HTTP request is done, just response.write in beginrequest/endrequest and in
your timer event and you'll better understand the control flow...)
--
"Piz" <tw*******@yaho o.com> a écrit dans le message de
news:11******** *************@g 43g2000cwa.goog legroups.com... I've read a previous discussion about the same topic, but there's a difference. I call HttpContext.Cur rent.Response.R edirect("file.t xt") from a ownmade sub in the global.asax. That doesn't works, i'm quite new in asp.net and so i don't know what a studip mistake i'm doing!!
here there's global asax code: <%@ Application Language="VB" %>
<script runat="server">
Sub Application_Sta rt(ByVal sender As Object, ByVal e As EventArgs)
End Sub
Sub CreateTimer() Dim myTimer As New System.Timers.T imer() myTimer.Interva l = 3000 myTimer.Enabled = True
AddHandler myTimer.Elapsed , New System.Timers.E lapsedEventHand ler(AddressOf Me.myTimer_Elap sed) End Sub
Sub myTimer_Elapsed (ByVal sender As System.Object, ByVal e As System.Timers.E lapsedEventArgs )
HttpContext.Cur rent.Response.R edirect("prova. txt") End Sub
Sub Application_End (ByVal sender As Object, ByVal e As EventArgs)
End Sub
Sub Application_Err or(ByVal sender As Object, ByVal e As EventArgs)
End Sub
Sub Session_Start(B yVal sender As Object, ByVal e As EventArgs)
CreateTimer()
End Sub
Sub Session_End(ByV al sender As Object, ByVal e As EventArgs) End Sub
</script>
"Piz" <tw*******@yaho o.com> wrote in message
news:11******** *************@g 43g2000cwa.goog legroups.com... That doesn't works, i'm quite new in asp.net and so i don't know what a studip mistake i'm doing!!
ASP.NET and timers really don't go well together. See the following for lots
of articles and discussions around this... http://www.google.com/search?sourcei...2ENET%22+Timer
i have to refresh a page on the client, but this should be done just
when a table is updated. The problem is that i can't use sql server
2005. This page runs on a palm device, so i can't use the "refresh"
header too, because it doesn't works.
So what can i do? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: JP |
last post by:
I need to be able to trap errors at the application level. I added this code
to the Global.asax file. The code I wrote is supposed to get the last error
that was generated and write to the event log as well as fire up my email
class and generate an email to send me the error. But no matter what I do, I
still get the icky looking yellow and...
|
by: vbMental |
last post by:
I am deep into a project and cannot get this to work correctly.
I am trying to make a custom error page that will be able to know what
exception occurred. I already know about the defaultRedirect page -
<customErrors mode="on" defaultRedirect="Error.aspx"/>
But how do I reference the exception that occurred from that page?
If I cant, then...
|
by: Jonas |
last post by:
Hi!
I have an Application_Error method in global.asax that uses Server.Transfer
to move execution to a custom error page. This works fine when an exception
is thrown in one of the aspx or ascx files. The errorpage.aspx uses
Server.GetLastError() and shows a friendly error page.
But when it happens in global.asax itself, the...
|
by: ad |
last post by:
I have set customErrors to On and set a defaultRedirect in Web.config like:
<customErrors mode="On"
defaultRedirect="~/ErrorPage/GenericErrorPage.aspx">
When I throw a exception in Global.asax like:
throw new Exception("This a Error Test !!");
It will not redirect to GenericErrorPage.aspx, but if I throw the same
Exception in other web...
|
by: furiousmojo |
last post by:
This is a strange problem. I have a project where the contents of
global.asax application_error are not firing. It is an asp.net 2.0
application using web application projects. I have another app using
web application projects and it's firing fine but it was upgraded from
the 1.1 framework.
Why doesn't my global.asax application_error...
| |
by: Groove |
last post by:
Hey guys - I'm sure this is a commonly asked question but here goes.
I'm trying to catch the error in my global.asax file and redirect to a error
page which will email me the actual error upon page load. Everything seems
to work OK except catch the actual error. It detects the error when I break
the connection string to MS SQL or pause the...
|
by: kurt sune |
last post by:
I have a generic errorhandler in global.asax.
(in Application_Error)
I need to transfer an error string from global asax to a generic error page.
So I try: this code with the thought of picking up the string from session
an Error.aspx.
1 Dim errorString As String = "the whole error string"
2 Try
|
by: daonho |
last post by:
Protected Sub Application_BeginRequest(ByVal sender As Object, ByVal e As System.EventArgs)
Dim strPath As String = HttpContext.Current.Request.Path()
Dim cookie As HttpCookie = HttpContext.Current.Request.Cookies("MyCookieName")
' Handle if cookie not exist
If cookie Is Nothing Then
...
|
by: user65 |
last post by:
Is it possible to convert the following redirects previously in global.asax and global.asa to the web.config file? My server crashed and most of the website works except for the old articles created under .asp extensions.
Web Service Extensions has: Active Server Pages, ASP 1, 2, and 4 "allowed"
Thanks in advance
global.asax:
void...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |