473,322 Members | 1,755 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,322 software developers and data experts.

Writing few messages before displaying a desired page

Hi,
I have the following code as a part of authenticating a system.
If Rs.eof Then
Session("Authenticated") = 0
Response.Write "Sorry, your userid or password did not match"
Response.Write "<BR>"
Response.Write "or you have not registered yet. Please register"
Response.Redirect("login.asp")
Else
Session("Authenticated") = 1
Response.Redirect ("Welcome.asp")
End If
In the first if statement, I would like to display the above messages
before forcing the login.asp page to display. Is is possible to do both
message and contents of login.asp in the same page? Thanks
Jul 22 '05 #1
3 1250
With Windows 2000 and above, response buffering is on by default. So, your
response.write statements won't ever make it to the browser since you then
send a redirect. If you were to turn off buffering, you'd see that this
actually causes an error. You cannot send a redirect command to the browser
after sending back response text. So, no, you cannot do what you're trying
to do, exactly. You can do:

<% If Rs.eof Then
Session("Authenticated") = 0
%>

Sorry, your userid or password did not match<br>or you have not registered
yet. Please register.
<a href="login.asp">Click me</a>

Ray at work
"Jack" <Ja**@discussions.microsoft.com> wrote in message
news:DA**********************************@microsof t.com...
Hi,
I have the following code as a part of authenticating a system.
If Rs.eof Then
Session("Authenticated") = 0
Response.Write "Sorry, your userid or password did not match"
Response.Write "<BR>"
Response.Write "or you have not registered yet. Please register"
Response.Redirect("login.asp")
Else
Session("Authenticated") = 1
Response.Redirect ("Welcome.asp")
End If
In the first if statement, I would like to display the above messages
before forcing the login.asp page to display. Is is possible to do both
message and contents of login.asp in the same page? Thanks

Jul 22 '05 #2
I got it Ray, Thanks for the help.

"Ray Costanzo [MVP]" wrote:
With Windows 2000 and above, response buffering is on by default. So, your
response.write statements won't ever make it to the browser since you then
send a redirect. If you were to turn off buffering, you'd see that this
actually causes an error. You cannot send a redirect command to the browser
after sending back response text. So, no, you cannot do what you're trying
to do, exactly. You can do:

<% If Rs.eof Then
Session("Authenticated") = 0
%>

Sorry, your userid or password did not match<br>or you have not registered
yet. Please register.
<a href="login.asp">Click me</a>

Ray at work
"Jack" <Ja**@discussions.microsoft.com> wrote in message
news:DA**********************************@microsof t.com...
Hi,
I have the following code as a part of authenticating a system.
If Rs.eof Then
Session("Authenticated") = 0
Response.Write "Sorry, your userid or password did not match"
Response.Write "<BR>"
Response.Write "or you have not registered yet. Please register"
Response.Redirect("login.asp")
Else
Session("Authenticated") = 1
Response.Redirect ("Welcome.asp")
End If
In the first if statement, I would like to display the above messages
before forcing the login.asp page to display. Is is possible to do both
message and contents of login.asp in the same page? Thanks


Jul 22 '05 #3

"Jack" <Ja**@discussions.microsoft.com> wrote in message
news:DA**********************************@microsof t.com...
Hi,
I have the following code as a part of authenticating a system.
If Rs.eof Then
Session("Authenticated") = 0
Response.Write "Sorry, your userid or password did not match"
Response.Write "<BR>"
Response.Write "or you have not registered yet. Please register"
Response.Redirect("login.asp")
Else
Session("Authenticated") = 1
Response.Redirect ("Welcome.asp")
End If
In the first if statement, I would like to display the above messages
before forcing the login.asp page to display. Is is possible to do both
message and contents of login.asp in the same page? Thanks


It is possible to do what you want - if you put the authentication checking
code on the same page as the log-in form, and post it to itself

dim strMessage
strMessage = "Please enter your Userid and Password"

If RS.EOF Then
Session("Authenticated")=0
strMessage = "Sorry, your userid or password did not match <br>"
strMessage = strMessage & "or you have not registered yet. Please
Register"
Else
..... etc, etc

then pop <%=strMessage%> in the appropriate place on the form page.


Jul 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Dariusz | last post by:
I have constructed a PHP generated HTML layout, which on POSTing the menu option the user selects, calls the same PHP code / page which generates the HTML page and GET's the correct SHTML page into...
4
by: George Stout | last post by:
First off I do not know alot about writing queries to an Access Database from an ASP page. This is why I need help. I have an Events database for 6 colleges in our metro area. On the homepage I...
3
by: Shabam | last post by:
I know that dotnet allows for form field validation. However I'm looking to customize the error message display and am wondering if it's possible to do what I need. Example: Suppose in a...
2
by: melanieab | last post by:
Hi, I'm trying to store all of my data into one file (there're about 140 things to keep track of). I have no problem reading a specific string from the array file, but I wasn't sure how to...
2
by: Irfan Akram | last post by:
Hi Guys, I was wondering if you can help me with this question. I am trying to display warning messages on my web-page, prompting the user to check his action, and confirm what the current...
1
by: sylvain | last post by:
Hi, I am implementing a ASP.Net form that have ValidationSummary. I want to have different color for an error message (red) and a warning message (blue). It seems that we cannot have multiple...
2
by: Fedor G via DotNetMonster.com | last post by:
Pls help me manage the data displaying on the webform aspx c# page. I used Dreamweaver to manage data displaying in the repeat table, ie simply dragged the fields to the table cells, where I need...
3
by: Chris Dunaway | last post by:
I am writing a Windows Service that reads and processes files on a set schedule. I want to create a second app that can monitor the Windows service. The Windows service will write trace messages...
3
by: Pacer Dawn | last post by:
I have a web control that takes a date input. There are two types of validation I want to do on this: 1) validate that the date input is in the proper format, and display a message if otherwise...
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...
1
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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.