Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Ok, after purchasing Visual Studio .net, doing millions of downloads and following directions here, I think I have ASP.net installed on my PC.

 

However, when I run the following code, I get a blank screen, no errors.

 

This page is opened by another page with the Value1, Value2 and Operator values embedded, and the header of the .apsx page is:

 

http://mediagate-219/Learning/math.aspx?value1=8&operator=add&value2=2

 

<%@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")
   try    
   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
   catch e as overflowexception
   response.write("The result was too large to represent as a decimal.")
   catch e as dividebyzeroexception
   response.write("You can't divide by zero!")
   finally
   Response.Write("The result of your calculation is: " & decResult)
   end try
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>

 

Am I missing the point of Resonse.Write?

Read the Fovean Chronicles

Because you just can't spend your whole day programming!

Posted

Figured it out

 

The problem is that VStudio.Net DOESN'T register ASP.Net and, despite what the ASP.Net website tells you, their method doesn't register it, either.

 

You have to go to the Command prompt and run the asp executables

 

Then you have to register the following .dll

 

regsvr32 C:\WINNT\Microsoft.NET\Framework\v1.0.3705\aspnet_isapi.dll

 

From Run

 

THEN it will work.

Read the Fovean Chronicles

Because you just can't spend your whole day programming!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...