B
Brian Miller
I've been constructing an ASP.Net application using the 1.1 framework,
and have been using Web Matrix for development purposes. Now that my
application is near completion, I wanted to see if I can set up my
pages for access directly via localhost (not using the WebMatrix
server). My login page loads, and any validation controls on the page
work fine, so I know it's recognizing the ASP.Net code there, however,
when I try to log on, the page just reloads with the login fields
blank. I've put a response.write line into my code to see where it's
executing, and the line does show when the page loads, confirming
things are working on initial load, but if I put that write line at
the beginning of the IsPostBack = True section, it does not show,
which makes me think the VB code isn't even running on postback at
all. If I run my app using the WebMatrix server, the PostBack VB code
does execute, as I can log in successfully and proceed through my
application (if login fails, there is user notification, to confirm is
has validated against the database). Is there something that I need
to do differently to configure IIS to make the folder run the
application correctly? Below is a streamlined version of my Page_Load
event. If anyone can provide info on how to make IIS work for this,
I'd really appreciate it!
Thanks,
Brian
<%@ Page Language="VB" %>
<%@ import Namespace="System.Data.SQLClient" %>
<%@ import Namespace="System.Data" %>
<script runat="server">
Dim LoginFailed As Boolean
Sub Page_Load()
If IsPostBack = True Then
Dim conPubs As SqlConnection
Dim strConString As String
Dim cmdReadUser As SqlCommand
Dim dtrUser As SqlDataReader
Dim userRole As String
Dim SQLString As String
Dim i As Integer
'Use the standard connection set in the web.config file
strConString =
ConfigurationSettings.AppSettings("ConnectionString")
conPubs = New SqlConnection(strConString)
'Validate the user name and password against the database
SQLString = ...
cmdReadUser = New SqlCommand(SQLString, conPubs)
conPubs.Open()
dtrUser =
cmdReadUser.ExecuteReader(CommandBehavior.SingleRow)
'If datareader can be read, there is a record found for
the user (login success)
If dtrUser.Read Then
'Set user role....
Response.Redirect("Page1.aspx")
Else
'Login failed
LoginFailed = True
End If
End If
End Sub
and have been using Web Matrix for development purposes. Now that my
application is near completion, I wanted to see if I can set up my
pages for access directly via localhost (not using the WebMatrix
server). My login page loads, and any validation controls on the page
work fine, so I know it's recognizing the ASP.Net code there, however,
when I try to log on, the page just reloads with the login fields
blank. I've put a response.write line into my code to see where it's
executing, and the line does show when the page loads, confirming
things are working on initial load, but if I put that write line at
the beginning of the IsPostBack = True section, it does not show,
which makes me think the VB code isn't even running on postback at
all. If I run my app using the WebMatrix server, the PostBack VB code
does execute, as I can log in successfully and proceed through my
application (if login fails, there is user notification, to confirm is
has validated against the database). Is there something that I need
to do differently to configure IIS to make the folder run the
application correctly? Below is a streamlined version of my Page_Load
event. If anyone can provide info on how to make IIS work for this,
I'd really appreciate it!
Thanks,
Brian
<%@ Page Language="VB" %>
<%@ import Namespace="System.Data.SQLClient" %>
<%@ import Namespace="System.Data" %>
<script runat="server">
Dim LoginFailed As Boolean
Sub Page_Load()
If IsPostBack = True Then
Dim conPubs As SqlConnection
Dim strConString As String
Dim cmdReadUser As SqlCommand
Dim dtrUser As SqlDataReader
Dim userRole As String
Dim SQLString As String
Dim i As Integer
'Use the standard connection set in the web.config file
strConString =
ConfigurationSettings.AppSettings("ConnectionString")
conPubs = New SqlConnection(strConString)
'Validate the user name and password against the database
SQLString = ...
cmdReadUser = New SqlCommand(SQLString, conPubs)
conPubs.Open()
dtrUser =
cmdReadUser.ExecuteReader(CommandBehavior.SingleRow)
'If datareader can be read, there is a record found for
the user (login success)
If dtrUser.Read Then
'Set user role....
Response.Redirect("Page1.aspx")
Else
'Login failed
LoginFailed = True
End If
End If
End Sub