Reference Page: https://www.raefkobeissi.com/bb/index2.aspx
I would like first to thank:mgebhard and Brando ZWZfor helping
me so far with another thread regarding Timer Control. I managed to make a label incrementally update every tick by using Shared variables. It worked perfectly fine on my localhost ( Using Visual Studio 2017 Community) but unfortunately when I uploaded my
test project to the server it just didn't work!
Note: The server I am using is hosted by smarterasp.net, I've created many aspx pages in the past and they all worked fine. I asked them if their server support AJAX and they said yes.
In Summary:
HTML Page including the script:
<script runat="server">
Shared C = 0
Protected Sub Button1_Click(sender As Object, e As EventArgs)
Timer1.Interval = 1000
Timer1.Enabled = True
End Sub
Protected Sub Timer1_Tick(sender As Object, e As EventArgs)
c=c+1
Label1.Text = c
End Sub</script><html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><title>New Page 1</title></head><body><form id="form1" runat="server"><asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager><asp:UpdatePanel ID="UpdatePanel1" runat="server"><Triggers><asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" /></Triggers><ContentTemplate><div style="position: absolute; width: 622px; height: 365px; z-index: 1; left: 758px; top: 99px" id="layer1"><div style="position: absolute; width: 100px; height: 46px; z-index: 1; left: -153px; top: 271px" id="layer6"> </div><div style="position: absolute; width: 100px; height: 46px; z-index: 1; left: -154px; top: 205px" id="layer5"> </div><div style="position: absolute; width: 100px; height: 46px; z-index: 1; left: -154px; top: 135px" id="layer4"> </div><div style="position: absolute; width: 100px; height: 46px; z-index: 1; left: -155px; top: 72px" id="layer3"> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label></div><div style="position: absolute; width: 100px; height: 46px; z-index: 1; left: -156px; top: 11px" id="layer2"> <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /></div><p> </div></ContentTemplate></asp:UpdatePanel><asp:Timer ID="Timer1" runat="server" OnTick="Timer1_Tick"></asp:Timer></form></body></html>Web.config File:
<?xml version="1.0" encoding="utf-8"?><!-- For more information on how to configure your ASP.NET application, please visit https://go.microsoft.com/fwlink/?LinkId=169433 --><configuration><system.web><compilation strict="false" explicit="true" targetFramework="4.6.1" /><httpRuntime targetFramework="4.6.1" /></system.web><system.codedom><compilers><compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" /><compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" /></compilers></system.codedom></configuration><!--ProjectGuid: 1C5EE324-242B-41FF-BCA9-9833993836F4-->
I honestly am not sure what have I done wrong! On my localhost it is working perfectly fine! no errors!
Debugging from browser under CONSOLE:
Failed to load resource: the server responded with a status of 404 (Not Found)
ScriptResource.axd:1 Failed to load resource: the server responded with a status of 404 (Not Found)
ScriptResource.axd:1 Failed to load resource: the server responded with a status of 404 (Not Found)
ScriptResource.axd:1 Failed to load resource: the server responded with a status of 404 (Not Found)
ScriptResource.axd:1 Failed to load resource: the server responded with a status of 404 (Not Found)
index2.aspx:48 Uncaught ReferenceError: Sys is not defined
at index2.aspx:48
index2.aspx:80 Uncaught ReferenceError: Sys is not defined
at index2.aspx:80