Response is not available in this context.
Posted on 2010-11-23
I call a subroutine in a class to set some session variables, the following code is within a try, however, an exception is raised (Response is not available in this context.) when I try to redirect to this page Response.Redirect("CreateNewProject.aspx"), why is this and what am I doing wrong?
'create new dataset to read the xml in the customer config table into.
Dim dsxml As New DataSet
Dim userNameStr As String = "UserName = '" & userName & "'"
'search for the user row based on thier username
Dim dataRows As DataRow() = dsxml.Tables(0).Select(userNameStr)
If dataRows(0).Item("NumberOfLogins") = 1 Then
'set session variables
Catch ex As Exception
l.writeToLogFile(Session.Item("customerLogFile"), "[Error #0031] Could not setup the session variables " & ex.Message.ToString)