By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,795 Members | 1,235 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,795 IT Pros & Developers. It's quick & easy.

ASP.Net VB code does not execute on postback (WebMatrix vs. not)

P: n/a
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("ConnectionStrin g")
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.SingleRo w)

'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
Nov 18 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Brian:

Make sure the ASP.NET JavaScript files are installed properly. There
is some script to handle client side events - you might notice IE has
an error icon in the lower left when things are not working.

You can install/reinstall the client files with:
aspnet_regiis -c

Where aspnet_regiis will be in the framework install directory.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On 25 Nov 2004 08:47:10 -0800, me*******@yahoo.com (Brian Miller)
wrote:
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("ConnectionStri ng")
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.SingleR ow)

'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


Nov 18 '05 #2

P: n/a
Scott,
Thanks for the reply. I'm not getting any script errors on my end,
but did run the command just to be sure that things are installed
here. Still the same issue of the page resubmitting to itself and
clearing out. Just for kicks, I tried opening a few different pages
of my application directly so I could make sure it's not just the
logon page that's doing this. The same thing seems to happen on all
pages...you can type in data, validation, and all other controls on
the page seem to load properly (HTML output from ASP.Net looks good),
but the page just clears when you try to submit the page, as if
postback is being ignored altogether. I also tried setting up an
ASPNET user account for the folder in IIS, as I'd seen messages on
that before, but that also did not help. Any other thoughts as to the
cause of this issue?

Thanks again,
Brian

Scott Allen <bitmask@[nospam].fred.net> wrote in message news:<4j********************************@4ax.com>. ..
Brian:

Make sure the ASP.NET JavaScript files are installed properly. There
is some script to handle client side events - you might notice IE has
an error icon in the lower left when things are not working.

You can install/reinstall the client files with:
aspnet_regiis -c

Where aspnet_regiis will be in the framework install directory.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On 25 Nov 2004 08:47:10 -0800, me*******@yahoo.com (Brian Miller)
wrote:
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("ConnectionStri ng")
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.SingleR ow)

'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

Nov 18 '05 #3

P: n/a
Did u install the new .Net?
Try updating ur asp_client folder.
Patrick

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #4

P: n/a
I have the 1.1 framework installed, if that's what you mean. I know
there's a 2.0 beta out there, but don't want to use that until the
official release. As for the asp_client folder, what settings need
changed there, as opposed to my application folder?

Thanks,
Brian

Patrick Olurotimi Ige <pa*********@crazyjohns.com.au> wrote in message news:<Of**************@TK2MSFTNGP09.phx.gbl>...
Did u install the new .Net?
Try updating ur asp_client folder.
Patrick

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #5

P: n/a
Have u installed/reinstalled the client files with:
aspnet_regiis -c as scott suggested?
What i thought about again is that how did u create your virtual
directory ?
Did u create it manually using the IIS wizard?
Or did u just create the folder under the WWWROOT.
Becos its best to have it created as an application
in IIS.
Are u using ASP.net web matrix server to run the application?
Patrick

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #6

P: n/a
I did do the reinstall using that command line as suggested, with no
change. I originally created the folder in Windows Explorer, but to
test here a minute ago, I deleted it, then set up the folder using the
wizard as you said. What default settings should I have to the folder
so that it works? I created the folder with the default
configuration, and it still just refreshes the page with cleared data
when I try to postback to the page. Should it just be read and run
privileges which are the defaults when you run the wizard, and are
there any other settings I would need to change? Please let me know
what settings I should have for Virtual Directory, as well as the
other tabs in IIS for properties to verify I have this right.

I have basically been using the Web Matrix server instead of IIS,
since it would not allow me to run the server. I'm on a timeline with
this project, so I needed to use whatever I could to at least see my
code in action (my site works great when I run the Web Matrix server
for this directory). It's when I shut down Web Matrix, and try to run
the site via IIS is where it has this page postback issue.

Please let me know about the settings, and thanks for your reply!

Brian

Patrick Olurotimi Ige <pa*********@crazyjohns.com.au> wrote in message news:<uC**************@TK2MSFTNGP09.phx.gbl>...
Have u installed/reinstalled the client files with:
aspnet_regiis -c as scott suggested?
What i thought about again is that how did u create your virtual
directory ?
Did u create it manually using the IIS wizard?
Or did u just create the folder under the WWWROOT.
Becos its best to have it created as an application
in IIS.
Are u using ASP.net web matrix server to run the application?
Patrick

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.