Ok. I give up! Help please

G

Guest

Hi,
I was following the article
http://msdn.microsoft.com/msdnmag/issues/03/12/DesignPatterns/default.aspx I
got everything working until I go the the Progress bar section. Here is where
I am stuck.

This is the vb.net code for the wait.aspx page

Public redirectPage As String = ""
Public secondsToWait As String = "0"
Public minutesToWait As String = "0"


Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

'Put user code to initialize the page here

'If Request.QueryString("redirectPage") <> "" Then
' redirectPage = Request.QueryString("redirectPage")
'End If

Dim secondsToWait As String = Request.QueryString("secondsToWait")
Dim minutesToWait As String = Request.QueryString("minutesToWait")

If (minutesToWait <> String.Empty) Then
secondsToWait = "0"
Else
Dim seconds As Integer = Int32.Parse(secondsToWait)
Dim minutes As Integer = seconds / 60

If (seconds Mod 60 = 0) And (minutes > 1) Then
minutesToWait = minutes.ToString()
secondsToWait = "0"
End If

End If


End Sub



This is the html


<%@ Page Language="vb" AutoEventWireup="false" Codebehind="wait.aspx.vb"
Inherits="Webtest.wait"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>wait</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">

<SCRIPT language="javascript">
var i = 0;
function redirectTo(targetPage, querystring, secondsForWaiting,
minutesForWaiting)
{
if (0 < targetPage.length)
{
b1.style.cursor="wait";
location.replace(targetPage + querystring);

if (secondsForWaiting.valueOf() > 0)
{
ProcessingLabel.innerText =
"This process can take up to "
+ secondsForWaiting + " seconds...";
timedIterations(secondsForWaiting);
}
else
{
if (minutesForWaiting.valueOf() > 0)
{
ProcessingLabel.innerText =
"This process can take up to "
+ minutesForWaiting + " minutes...";
timedIterations(minutesForWaiting * 60);
}
}
}
else
{
ProcessingLabel.innerText = "Page not found."
}
}

function timedIterations(secondsForIterating)
{
incrementalWidth = 800 / secondsForIterating;
if (i <= secondsForIterating + 10)
{
d1.innerText="Elapsed time: " + i + " seconds.";
d2.style.width=i*incrementalWidth;
setTimeout(
"timedIterations(" + secondsForIterating + ");",
1000);
i++;
}
else
{
b1.style.cursor="";
d1.style.visibility = "hidden";
d2.style.visibility = "hidden";
ProcessingLabel.innerText =
"The server is taking longer than "
+ "anticipated to process your request. "
+ "Thank you for your patience. "
+ "You can wait a few minutes longer for "
+ "the process to complete, or you can press "
+ "the back button and try again later...";
}
}
</SCRIPT>






</HEAD>
<body id=b1
onload="redirectTo('<%Response.Write(redirectPage)%>','<%Response.Write(Request.Url.Query)%>','<%Response.Write(secondsToWait)%>','<%Response.Write(minutesToWait)%>')">
<form id="Form1" method="post" runat="server">
<asp:Label id="ProcessingLabel" runat="server"
CssClass="DarkMediumSizeText">Processing...</asp:Label>
<p></p>
<DIV id="d1" class="DarkSmallSizeText"></DIV>
<DIV id="d2" style="BACKGROUND-COLOR:red"></DIV>
</form>
</body>
</HTML>


When I call the wait page from my "starttheprocess.aspx" page with this

Response.Redirect("Wait.aspx?redirectPage=" + "ProcessTheData.aspx&Data=" +
TextBox1.Text + "&secondsToWait=30")

I get

Page not found.

Thats from the javascript.

Any ideas? Please.

Thanks
 
G

Guest

Are just pasting the Jscript before the HEAD element in ASP.NET(HTML)?
Or you are registering it?
 
J

Jeff Dillon

What is the address of the "page not found". What appears in the address
bar?

Seems like you could reproduce the problem in 2-3 lines of code around the
Response.Redirect, by hard-coding values, to start.

Jeff
Chris said:
Hi,
I was following the article
http://msdn.microsoft.com/msdnmag/issues/03/12/DesignPatterns/default.aspx I
got everything working until I go the the Progress bar section. Here is where
I am stuck.

This is the vb.net code for the wait.aspx page

Public redirectPage As String = ""
Public secondsToWait As String = "0"
Public minutesToWait As String = "0"


Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

'Put user code to initialize the page here

'If Request.QueryString("redirectPage") <> "" Then
' redirectPage = Request.QueryString("redirectPage")
'End If

Dim secondsToWait As String = Request.QueryString("secondsToWait")
Dim minutesToWait As String = Request.QueryString("minutesToWait")

If (minutesToWait <> String.Empty) Then
secondsToWait = "0"
Else
Dim seconds As Integer = Int32.Parse(secondsToWait)
Dim minutes As Integer = seconds / 60

If (seconds Mod 60 = 0) And (minutes > 1) Then
minutesToWait = minutes.ToString()
secondsToWait = "0"
End If

End If


End Sub



This is the html


<%@ Page Language="vb" AutoEventWireup="false" Codebehind="wait.aspx.vb"
Inherits="Webtest.wait"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>wait</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">

<SCRIPT language="javascript">
var i = 0;
function redirectTo(targetPage, querystring, secondsForWaiting,
minutesForWaiting)
{
if (0 < targetPage.length)
{
b1.style.cursor="wait";
location.replace(targetPage + querystring);

if (secondsForWaiting.valueOf() > 0)
{
ProcessingLabel.innerText =
"This process can take up to "
+ secondsForWaiting + " seconds...";
timedIterations(secondsForWaiting);
}
else
{
if (minutesForWaiting.valueOf() > 0)
{
ProcessingLabel.innerText =
"This process can take up to "
+ minutesForWaiting + " minutes...";
timedIterations(minutesForWaiting * 60);
}
}
}
else
{
ProcessingLabel.innerText = "Page not found."
}
}

function timedIterations(secondsForIterating)
{
incrementalWidth = 800 / secondsForIterating;
if (i <= secondsForIterating + 10)
{
d1.innerText="Elapsed time: " + i + " seconds.";
d2.style.width=i*incrementalWidth;
setTimeout(
"timedIterations(" + secondsForIterating + ");",
1000);
i++;
}
else
{
b1.style.cursor="";
d1.style.visibility = "hidden";
d2.style.visibility = "hidden";
ProcessingLabel.innerText =
"The server is taking longer than "
+ "anticipated to process your request. "
+ "Thank you for your patience. "
+ "You can wait a few minutes longer for "
+ "the process to complete, or you can press "
+ "the back button and try again later...";
}
}
</SCRIPT>






</HEAD>
<body id=b1
onload="redirectTo('<%Response.Write(redirectPage)%>','<%Response.Write(Requ
 
J

Jeff Dillon

So what happens when you manually browse to this page? Does it exist??

And what exactly are you trying to accomplish?

Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top