473,320 Members | 1,859 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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

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
6 2900
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: R Reyes | last post by:
is there a way to avoid the validateRequest error page in my code behind file? i can't seem to find a way to handle the error w/o an error code or exception being thrown... i am NOT looking for...
1
by: nicholas | last post by:
I use WebMatrix to modifie my asp.NET pages. Now, I noticed that WebMatrix changes the code without saying anything. example: <IMAGE ... is replaced with <img... (this is a specific tag for a...
2
by: Joriz | last post by:
I have an image button that when click executes this Private Sub btnContact_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnContact.Click ...
3
by: Carpe Diem | last post by:
Hello, I'm trying to find a decent editor for my preffered .NET language. I currently use textpad, which has nice syntax colouring, but no word completion. I've been trying primalcode too, but it...
171
by: tshad | last post by:
I am just trying to decide whether to split my code and uses code behind. I did it with one of my pages and found it was quite a bit of trouble. I know that most people (and books and articles)...
7
by: | last post by:
I am having trouble figuring out to call a database INSERT procedure from a simple submit form. It appears I should use the onclick event to trigger the procedure called BUT when I do this I...
7
by: \A_Michigan_User\ | last post by:
What I need to do: Create ASP.net 1.1 web-pages. Use VB.net (server-side). Use VBscript (client-side). Use MS-SQL 2000 on a remote-server hosting company. What I do *NOT* need to do: Create...
2
by: Bahman | last post by:
Hello! Except for dropdownlists, all other controls have lost their postback call. The default postback call runs all the time. What would be the more likely cause for this? Thank you for...
1
by: Richard | last post by:
Hi, I'm running WebMatrix, v. 0.6.812, over WinXP/SP2 with .Net Framework 1.0 & 1.1. I'm following the examples in ASP.NET Web Matrix Project Guided Tour, specifically the 2nd example at...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.