473,387 Members | 1,844 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

The beginning.

Ok,

I have a file 'WeatherPage.aspx' with the following code, basic stuff:

<%@ Page language="VB" %>
<script runat="server">

Shared rand As Random = New Random()
Function GetForecast(zip As String) As String
Dim ret As String = String.Empty
Select rand.Next(5)
Case 0
ret = "Sunny and warm"
Case 1
ret = "Partly cloudy and chilly"
Case 2
ret = "Cold with a chance of snow"
Case 3
ret = "Rain"
Case 4
ret = "Foggy and damp"
End Select
Return ret
End Function

</script>
<html>
<body>
<h1>My weather forecast page</h1>
<p>The weather for zipcode 04090 is: <%= GetForecast("04090") %> </p>
<p>The weather for zipcode 90210 is: <%= GetForecast("90210") %> </p>
<p>The weather for zipcode 84101 is: <%= GetForecast("84101") %> </p>
<p>The weather for zipcode 80014 is: <%= GetForecast("80014") %> </p>
<p>The weather for zipcode 02101 is: <%= GetForecast("02101") %> </p>
</body>
</html>
my operating system is Windows XP profesional. I use Internet Information
Services 5.1 (IIS).

When I run this page in a webbrowser, the function 'GetForecast' doesn't
display anything ( no error's). All I see is the HTML text. What can I be
doing wrong? I got this code from a tutorial.
Is the code incorrect? Can IIS have incorrect settings?

Thanks.
Nov 19 '05 #1
6 1090
The browser does give an error: Line 4, ";" is expected.
Isn't ";" used for "C#".
Page language is set to "VB".
"Qwert" <no**@nosp.com> schreef in bericht
news:Cp********************@casema.nl...
Ok,

I have a file 'WeatherPage.aspx' with the following code, basic stuff:

<%@ Page language="VB" %>
<script runat="server">

Shared rand As Random = New Random()
Function GetForecast(zip As String) As String
Dim ret As String = String.Empty
Select rand.Next(5)
Case 0
ret = "Sunny and warm"
Case 1
ret = "Partly cloudy and chilly"
Case 2
ret = "Cold with a chance of snow"
Case 3
ret = "Rain"
Case 4
ret = "Foggy and damp"
End Select
Return ret
End Function

</script>
<html>
<body>
<h1>My weather forecast page</h1>
<p>The weather for zipcode 04090 is: <%= GetForecast("04090") %> </p>
<p>The weather for zipcode 90210 is: <%= GetForecast("90210") %> </p>
<p>The weather for zipcode 84101 is: <%= GetForecast("84101") %> </p>
<p>The weather for zipcode 80014 is: <%= GetForecast("80014") %> </p>
<p>The weather for zipcode 02101 is: <%= GetForecast("02101") %> </p>
</body>
</html>
my operating system is Windows XP profesional. I use Internet Information
Services 5.1 (IIS).

When I run this page in a webbrowser, the function 'GetForecast' doesn't
display anything ( no error's). All I see is the HTML text. What can I be
doing wrong? I got this code from a tutorial.
Is the code incorrect? Can IIS have incorrect settings?

Thanks.

Nov 19 '05 #2
You need to enclose your frunctions within

Sub

End Sub

statements.

If you want the code to execut automatically
when the page loads, use Sub Page_Load :

<script runat="server">
Sub Page_Load(Src as Object, e As System.EventArgs)

....rest of your code

End Sub
<//script>

best,
Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Qwert" <no**@nosp.com> wrote in message
news:Cp********************@casema.nl...
Ok,

I have a file 'WeatherPage.aspx' with the following code, basic stuff:

<%@ Page language="VB" %>
<script runat="server"> Shared rand As Random = New Random()
Function GetForecast(zip As String) As String
Dim ret As String = String.Empty
Select rand.Next(5)
Case 0
ret = "Sunny and warm"
Case 1
ret = "Partly cloudy and chilly"
Case 2
ret = "Cold with a chance of snow"
Case 3
ret = "Rain"
Case 4
ret = "Foggy and damp"
End Select
Return ret
End Function

</script>
<html>
<body>
<h1>My weather forecast page</h1>
<p>The weather for zipcode 04090 is: <%= GetForecast("04090") %> </p>
<p>The weather for zipcode 90210 is: <%= GetForecast("90210") %> </p>
<p>The weather for zipcode 84101 is: <%= GetForecast("84101") %> </p>
<p>The weather for zipcode 80014 is: <%= GetForecast("80014") %> </p>
<p>The weather for zipcode 02101 is: <%= GetForecast("02101") %> </p>
</body>
</html>
my operating system is Windows XP profesional. I use Internet Information
Services 5.1 (IIS).

When I run this page in a webbrowser, the function 'GetForecast' doesn't
display anything ( no error's). All I see is the HTML text. What can I be
doing wrong? I got this code from a tutorial.
Is the code incorrect? Can IIS have incorrect settings?

Thanks.

Nov 19 '05 #3
You mean something like this, it does not work either:

<html>

<script language="VB" runat="server">
Sub Page_Load(Sender As Object, E As EventArgs)
Message.Text = "You last accessed this page at: " & DateTime.Now
End Sub
</script>

<body>
<h3><font face="Verdana">Manipulating Server Controls</font></h3>
This sample demonstrates how to manipulate the &lt;asp:label&gt;
server control within
the Page_Load event to output the current time.
<p>
<hr>
<asp:label id="Message" font-size="24" font-bold="true"
runat=server/>
</body>
</html>
I see the HTML in the browser, but not the Message.Text in the label
control.
"Juan T. Llibre" <no***********@nowhere.com> schreef in bericht
news:ew**************@TK2MSFTNGP14.phx.gbl...
You need to enclose your frunctions within

Sub

End Sub

statements.

If you want the code to execut automatically
when the page loads, use Sub Page_Load :

<script runat="server">
Sub Page_Load(Src as Object, e As System.EventArgs)

...rest of your code

End Sub
<//script>

best,
Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Qwert" <no**@nosp.com> wrote in message
news:Cp********************@casema.nl...
Ok,

I have a file 'WeatherPage.aspx' with the following code, basic stuff:

<%@ Page language="VB" %>
<script runat="server">

Shared rand As Random = New Random()
Function GetForecast(zip As String) As String
Dim ret As String = String.Empty
Select rand.Next(5)
Case 0
ret = "Sunny and warm"
Case 1
ret = "Partly cloudy and chilly"
Case 2
ret = "Cold with a chance of snow"
Case 3
ret = "Rain"
Case 4
ret = "Foggy and damp"
End Select
Return ret
End Function

</script>
<html>
<body>
<h1>My weather forecast page</h1>
<p>The weather for zipcode 04090 is: <%= GetForecast("04090") %> </p>
<p>The weather for zipcode 90210 is: <%= GetForecast("90210") %> </p>
<p>The weather for zipcode 84101 is: <%= GetForecast("84101") %> </p>
<p>The weather for zipcode 80014 is: <%= GetForecast("80014") %> </p>
<p>The weather for zipcode 02101 is: <%= GetForecast("02101") %> </p>
</body>
</html>
my operating system is Windows XP profesional. I use Internet Information
Services 5.1 (IIS).

When I run this page in a webbrowser, the function 'GetForecast' doesn't
display anything ( no error's). All I see is the HTML text. What can I be
doing wrong? I got this code from a tutorial.
Is the code incorrect? Can IIS have incorrect settings?

Thanks.


Nov 19 '05 #4
I just pasted your code into
http://asp.net.do/test/vbtest2.aspx

It works fine.

Are you using http://localhost/virtualdirectory/yourfile.aspx ?
Or http://localhost/yourfile.aspx ?
Or http://YourComputerName/virtualdirectory/yourfile.aspx ?
Or http://yourserver.com/directory/yourfile.aspx ?

If you are, and it still doesn't work, try re-registering ASP.NET
from the .NET framework's main directory :

aspnet_regiis -i

( You did install the .NET Framework, right ? )


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Qwert" <no**@nosp.com> wrote in message
news:Cp********************@casema.nl...
You mean something like this, it does not work either:

<html>

<script language="VB" runat="server">
Sub Page_Load(Sender As Object, E As EventArgs)
Message.Text = "You last accessed this page at: " &
DateTime.Now
End Sub
</script>

<body>
<h3><font face="Verdana">Manipulating Server Controls</font></h3>
This sample demonstrates how to manipulate the &lt;asp:label&gt;
server control within
the Page_Load event to output the current time.
<p>
<hr>
<asp:label id="Message" font-size="24" font-bold="true"
runat=server/>
</body>
</html>
I see the HTML in the browser, but not the Message.Text in the label
control.
"Juan T. Llibre" <no***********@nowhere.com> schreef in bericht
news:ew**************@TK2MSFTNGP14.phx.gbl...
You need to enclose your frunctions within

Sub

End Sub

statements.

If you want the code to execut automatically
when the page loads, use Sub Page_Load :

<script runat="server">
Sub Page_Load(Src as Object, e As System.EventArgs)

...rest of your code

End Sub
<//script>

best,
Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Qwert" <no**@nosp.com> wrote in message
news:Cp********************@casema.nl...
Ok,

I have a file 'WeatherPage.aspx' with the following code, basic stuff:

<%@ Page language="VB" %>
<script runat="server">

Shared rand As Random = New Random()
Function GetForecast(zip As String) As String
Dim ret As String = String.Empty
Select rand.Next(5)
Case 0
ret = "Sunny and warm"
Case 1
ret = "Partly cloudy and chilly"
Case 2
ret = "Cold with a chance of snow"
Case 3
ret = "Rain"
Case 4
ret = "Foggy and damp"
End Select
Return ret
End Function

</script>
<html>
<body>
<h1>My weather forecast page</h1>
<p>The weather for zipcode 04090 is: <%= GetForecast("04090") %> </p>
<p>The weather for zipcode 90210 is: <%= GetForecast("90210") %> </p>
<p>The weather for zipcode 84101 is: <%= GetForecast("84101") %> </p>
<p>The weather for zipcode 80014 is: <%= GetForecast("80014") %> </p>
<p>The weather for zipcode 02101 is: <%= GetForecast("02101") %> </p>
</body>
</html>
my operating system is Windows XP profesional. I use Internet
Information Services 5.1 (IIS).

When I run this page in a webbrowser, the function 'GetForecast' doesn't
display anything ( no error's). All I see is the HTML text. What can I
be doing wrong? I got this code from a tutorial.
Is the code incorrect? Can IIS have incorrect settings?

Thanks.



Nov 19 '05 #5
> If you are, and it still doesn't work, try re-registering ASP.NET
from the .NET framework's main directory :

aspnet_regiis -i
It worked.....but weird. Someone already installed .NET Framework. Doesn't
make sense ASP.NET needs a seperate installement....I wasn't there when it
was installed on my comp, maybe you can select an option during installation
that you don't want to install ASP.NET.

3 cheers for spain!

Thanks.


( You did install the .NET Framework, right ? )

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Qwert" <no**@nosp.com> wrote in message
news:Cp********************@casema.nl...
You mean something like this, it does not work either:

<html>

<script language="VB" runat="server">
Sub Page_Load(Sender As Object, E As EventArgs)
Message.Text = "You last accessed this page at: " &
DateTime.Now
End Sub
</script>

<body>
<h3><font face="Verdana">Manipulating Server Controls</font></h3>
This sample demonstrates how to manipulate the &lt;asp:label&gt;
server control within
the Page_Load event to output the current time.
<p>
<hr>
<asp:label id="Message" font-size="24" font-bold="true"
runat=server/>
</body>
</html>
I see the HTML in the browser, but not the Message.Text in the label
control.
"Juan T. Llibre" <no***********@nowhere.com> schreef in bericht
news:ew**************@TK2MSFTNGP14.phx.gbl...
You need to enclose your frunctions within

Sub

End Sub

statements.

If you want the code to execut automatically
when the page loads, use Sub Page_Load :

<script runat="server">
Sub Page_Load(Src as Object, e As System.EventArgs)

...rest of your code

End Sub
<//script>

best,
Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Qwert" <no**@nosp.com> wrote in message
news:Cp********************@casema.nl...
Ok,

I have a file 'WeatherPage.aspx' with the following code, basic stuff:

<%@ Page language="VB" %>
<script runat="server">

Shared rand As Random = New Random()
Function GetForecast(zip As String) As String
Dim ret As String = String.Empty
Select rand.Next(5)
Case 0
ret = "Sunny and warm"
Case 1
ret = "Partly cloudy and chilly"
Case 2
ret = "Cold with a chance of snow"
Case 3
ret = "Rain"
Case 4
ret = "Foggy and damp"
End Select
Return ret
End Function

</script>
<html>
<body>
<h1>My weather forecast page</h1>
<p>The weather for zipcode 04090 is: <%= GetForecast("04090") %> </p>
<p>The weather for zipcode 90210 is: <%= GetForecast("90210") %> </p>
<p>The weather for zipcode 84101 is: <%= GetForecast("84101") %> </p>
<p>The weather for zipcode 80014 is: <%= GetForecast("80014") %> </p>
<p>The weather for zipcode 02101 is: <%= GetForecast("02101") %> </p>
</body>
</html>
my operating system is Windows XP profesional. I use Internet
Information Services 5.1 (IIS).

When I run this page in a webbrowser, the function 'GetForecast'
doesn't display anything ( no error's). All I see is the HTML text.
What can I be doing wrong? I got this code from a tutorial.
Is the code incorrect? Can IIS have incorrect settings?

Thanks.



Nov 19 '05 #6
re:
Thanks.
You're very much welcome!
Glad it worked!

re: Someone already installed .NET Framework. Doesn't make sense ASP.NET needs
a seperate installement.
Maybe someone uninstalled/reinstalled IIS ?
That would require re-registering ASP.NET with the new IIS.

re: 3 cheers for spain!


Make that the Dominican Republic... ;-)

Happy coding!
Don't let the bug(ger)s get you!

:-)

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Qwert" <no**@nosp.com> wrote in message
news:-b********************@casema.nl...
If you are, and it still doesn't work, try re-registering ASP.NET
from the .NET framework's main directory :

aspnet_regiis -i


It worked.....but weird. Someone already installed .NET Framework. Doesn't
make sense ASP.NET needs a seperate installement....I wasn't there when it
was installed on my comp, maybe you can select an option during
installation that you don't want to install ASP.NET.

3 cheers for spain!

Thanks.

( You did install the .NET Framework, right ? )

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Qwert" <no**@nosp.com> wrote in message
news:Cp********************@casema.nl...
You mean something like this, it does not work either:

<html>

<script language="VB" runat="server">
Sub Page_Load(Sender As Object, E As EventArgs)
Message.Text = "You last accessed this page at: " &
DateTime.Now
End Sub
</script>

<body>
<h3><font face="Verdana">Manipulating Server Controls</font></h3>
This sample demonstrates how to manipulate the &lt;asp:label&gt;
server control within
the Page_Load event to output the current time.
<p>
<hr>
<asp:label id="Message" font-size="24" font-bold="true"
runat=server/>
</body>
</html>
I see the HTML in the browser, but not the Message.Text in the label
control.
"Juan T. Llibre" <no***********@nowhere.com> schreef in bericht
news:ew**************@TK2MSFTNGP14.phx.gbl...
You need to enclose your frunctions within

Sub

End Sub

statements.

If you want the code to execut automatically
when the page loads, use Sub Page_Load :

<script runat="server">
Sub Page_Load(Src as Object, e As System.EventArgs)

...rest of your code

End Sub
<//script>

best,
Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Qwert" <no**@nosp.com> wrote in message
news:Cp********************@casema.nl...
> Ok,
>
> I have a file 'WeatherPage.aspx' with the following code, basic stuff:
>
> <%@ Page language="VB" %>
> <script runat="server">

> Shared rand As Random = New Random()
> Function GetForecast(zip As String) As String
> Dim ret As String = String.Empty
> Select rand.Next(5)
> Case 0
> ret = "Sunny and warm"
> Case 1
> ret = "Partly cloudy and chilly"
> Case 2
> ret = "Cold with a chance of snow"
> Case 3
> ret = "Rain"
> Case 4
> ret = "Foggy and damp"
> End Select
> Return ret
> End Function
>
> </script>
> <html>
> <body>
> <h1>My weather forecast page</h1>
> <p>The weather for zipcode 04090 is: <%= GetForecast("04090") %> </p>
> <p>The weather for zipcode 90210 is: <%= GetForecast("90210") %> </p>
> <p>The weather for zipcode 84101 is: <%= GetForecast("84101") %> </p>
> <p>The weather for zipcode 80014 is: <%= GetForecast("80014") %> </p>
> <p>The weather for zipcode 02101 is: <%= GetForecast("02101") %> </p>
> </body>
> </html>
>
>
> my operating system is Windows XP profesional. I use Internet
> Information Services 5.1 (IIS).
>
> When I run this page in a webbrowser, the function 'GetForecast'
> doesn't display anything ( no error's). All I see is the HTML text.
> What can I be doing wrong? I got this code from a tutorial.
> Is the code incorrect? Can IIS have incorrect settings?
>
> Thanks.



Nov 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Steven T. Hatton | last post by:
I came across this title while looking for something fairly unrelated (UML diagrams for C++ templates). The review quoted below is solidly positive. I'm not going to be able to run out an buy the...
4
by: Thierry Lam | last post by:
Let's say I already wrote a file and have the following: testing testing testing testing testing testing Is there an easy way to write something of variable length at the top of the file? ...
5
by: anas.hashmi | last post by:
I am trying to write to the beginning of a file. The reason: I want to make a form where board webmasters can use it to insert in updates to a webpage without having to go directly into the web...
3
by: Matt | last post by:
Given a date, how to find the beginning date and ending date of that week please advise!
36
by: invni | last post by:
I have a nested while. How do I go from the inner while to the beginning of the outer while? Can this be done without using goto? while_1() { some codes here while_2() { if true go to the...
16
by: btopenworld | last post by:
Hi - question from a relative asp novice I have written to text files in the past, but always appending new data to the end of the text file. I now want to add the new data to the beginning of...
2
by: BobRoyAce | last post by:
I am using an IO.StreamReader to read the contents of a text file. It all works just fine. However, I do not know of a way to move back to the beginning of a file. For example, let's say that I...
1
by: OBAFGKM_RNS | last post by:
In my html, I have an embedded sound wav. I access that sound from my javascript using Play() and Stop(). However, once stopped, the sound will aways resume from where it left off, (making Stop...
3
by: Petimus | last post by:
Nowhere can I find the beginning of line Character for Regex in C#. Im using the expression *(, *)*$ But without the <Beginning of line>*(, *)*$ my strings are accepted with random letters in them...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.