Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Newbie
Message
From
16/09/2005 09:12:00
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
16/09/2005 08:52:45
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
General information
Forum:
ASP.NET
Category:
Other
Title:
Re: Newbie
Environment versions
Environment:
VB.NET 1.1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01050216
Message ID:
01050224
Views:
13
This message has been marked as the solution to the initial question of the thread.
>Hello,
>I am trying to learn ASP.NET out of a book, and I am having some problems that I can't figure out.
>
>What the book told me to do is put the following HTML file into my c:\inetpub\wwwroot dir:
>
>
><html>
><head>
><title>
>ASP.NET Mathematical Sample
></title>
></head>
><body>
><form method="GET" action="math.aspx">
>   <input type="text" name="value1">
><select name="operator">
>    <option value="add">+
>    <option value="subtract">-
>    <option value="multiply">x
>    <option value="divide">/
>   </select>
>   <input type="text" name="value2">
>   <input type="submit" value="Get Result">
></form>
></body>
></html>
>
>
>I did this, and then it told me to create a virtual directory, which I did (mapped to Desktop\Test) and called test, and put in the following (math.aspx):
>
>
><%@Import Namespace="System.Decimal"
><script language="VB" runat="server">
>Sub Page_Load(Source as Object, E As EventArgs)
>Dim decValue1       As Decimal
>Dim decValue2       As Decimal
>Dim strOperator     As String
>Dim decResult       As Decimal
>decValue1 = Request.QueryString("value1")
>decValue2 = Request.QueryString("value2")
>strOperator = Request.QueryString("operator")
>
>Select Case strOperator
>Case "multiply"
>decResult = MultiplyValues(decValue1, decValue2)
>Case "divide"
>decResult = DivideValues(decValue1, decValue2)
>Case "add"
>decResult = AddValues(decValue1, decValue2)
>Case "subtract"
>decResult = SubtractValues(decValue1, decValue2)
>End Select
>
>Response.Write("The result of your calculation is: " & _
>decResult)
>End Sub
>
>Function MultiplyValues(decValue1 As Decimal, decValue2 As _
>Decimal)
>
>Dim decResult As Decimal
>decResult = Multiply(decValue1, decValue2)
>Return decResult
>
>End Function
>
>Function DivideValues(decValue1 As Decimal, decValue2 As _
>Decimal)
>
>Dim decResult As Decimal
>decResult = Divide(decValue1, decValue2)
>Return decResult
>
>End Function
>
>Function AddValues(decValue1 As Decimal, decValue2 As _
>Decimal)
>
>Dim decResult As Decimal
>decResult = Add(decValue1, decValue2)
>Return decResult
>
>End Function
>
>Function SubtractValues(decValue1 As Decimal, decValue2 As _
>Decimal)
>
>Dim decResult As Decimal
>decResult = Subtract(decValue1, decValue2)
>Return decResult
>
>End Function
></script>
>
>
>What happens is if I click on the Get Result button on my html page, it says it can't find the file c:\inetpub\wwwroot\math.aspx. So I moved the math.aspx file to that dir, tried again, and it just brought up the source code instead of performing the operation.
>
>I am an absolute newb at ASP.NET, and I don't know how the troubleshoot this problem. I went through the instructions in the book again, and I seemed to have followed them as well as I could, given they were pretty sketchy.
>
>Any advice? Thanks a lot!
>
>MAC

Mike,
This is a hard way to learn it, anyway seeing a simple thing working puts a smile on face:)
OK lets make it work at least:
-Under inetpub\wwwroot create a folder say named "MikeTest" (wwwroot would do but we don't want to fill test stuff there).
-In your new folder create 2 text files (right text files so you can dblclick to edit)
-Put your codes into those 2 files (HTML stuff into one and aspx code stuff in other). BTW probably it only doesn't display right here. Check first line of your aspx code. It should have a closing tag ( <%@Import Namespace="System.Decimal"> ).
-Rename your text files to MathTest.htm and Math.aspx respectively (confirm to dialog about changing extension)
-Open a browser session and navigate to address:
http://localhost/MikeTest/MathTest.htm

Don't worry if it gets too long to calculate first one. ASPX is being compiled for the first time.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform