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

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
 
S

Scott Allen

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.
 
B

Brian Miller

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
 
P

Patrick Olurotimi Ige

Did u install the new .Net?
Try updating ur asp_client folder.
Patrick
 
B

Brian Miller

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
 
P

Patrick Olurotimi Ige

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
 
B

Brian Miller

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top