I am attempting to use a simple querystring passed from a VB application into my aspx page, ASP .NET 2.0. The following error appears no matter how it is arranged as suggested in the forum search results for similar problems:
---------------------------------------------------------
Exception Details: System.Web.HttpException: Request is not available in this context
Source Error:
Line 48: Public Sub Run()
Line 49:
Line 50: param = Request.QueryString("name") <-------------
Line 51: If (param Is Nothing) Then
Line 52: Console.Write("Query string is null")
Here is the code I'm using:
(code behind page)
Imports System
Imports System.Data
Imports System.Data.OleDb
Imports System.XML
Imports System.Web
Imports Microsoft.VisualBasic
Imports System.IO
Namespace Security.Landing
Class _Default
Inherits System.Web.UI.Page
Public param As String
Public Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim writer As StringWriter
writer = New StringWriter
Console.SetOut(writer)
Dim myemployees As _Default
myemployees = New _Default
myemployees.Run()
output.InnerHtml = writer.ToString()
End Sub
Public Shared Sub Main()
Dim myemployees As _Default
myemployees = New _Default
myemployees.Run()
End Sub
Public Sub Run()
param = Request.QueryString("name") <-------------------------
If (param Is Nothing) Then
Console.Write("Query string is null")
Else
Console.Write("Name: " + param.ToString)
End If
End Sub
End Class
End Namespace
--------------------------------
Does anyone see the error of my ways?
Many Thanks