Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3393558
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:03:53+00:00 2026-05-18T04:03:53+00:00

I am trying to create the following scenario… A user logs in by inserting

  • 0

I am trying to create the following scenario…

  • A user logs in by inserting their user id and password.
  • If they don’t have an email address assigned to their login details they are asked to submit one before they can continue.
  • They then continue to the home page in a logged in state.

The trouble I’m having is that the user id and password are not retained when they submit their email address so the login fails.

Here’s the code…

Dim userid as String
Dim password as String

Sub Page_Load(ByVal Sender as Object, ByVal E as EventArgs)

end sub


Sub Page_Transfer()

Dim userLookup As mySource.myData = New mySource.myData()
Dim drSet1 As DataSet = userLookup.xyz("SELECT * FROM OPENQUERY (myDatabase,' SELECT userid, password, email1 FROM userInfo WHERE userid = ''" & userid & "'' AND password = ''" & password & "'' ') ")

If drSet1.Tables(0).Rows.Count < 1 Then
    'Invalid Bond number
    Page.ClientScript.RegisterClientScriptInclude("loginError", "scripts/loginError.js")
Else

        If drSet1.Tables(0).Rows(0).Item("email1") = "" Then
            'No email address
            Page.ClientScript.RegisterClientScriptInclude("emailAddressSubmit", "scripts/emailAddressSubmit.js")
        Else

            response.redirect("home.aspx")

        End If

End If

End Sub


Sub Submit_Email(sender As Object, e As System.Web.UI.ImageClickEventArgs)

'script to add email address to database
'this is where the strings are losing their values

Page_Transfer()

End Sub


Sub Submit_login(sender As Object, e As System.Web.UI.ImageClickEventArgs)

userid = Trim(useridfield.text)
password = Trim(passwordfield.text)

Page_Transfer()

End Sub

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T04:03:54+00:00Added an answer on May 18, 2026 at 4:03 am

    The problem is that, with every postback, the page goes through a full new lifecycle. That means that any instance variables of your page which you set during one postback are lost in the next one.

    How to solve this problem? You have the following options:

    1. Read userid and password again from the controls (useridfield and passwordfield). Since ASP.NET controls use the view state to retain their values after postback, the value in these controls should still be valid.

    2. Use the view state yourself to save the variable’s values, i.e., replace

      Dim userid as String 
      Dim password as String 
      

      with

      Protected Property userid As String
          Get
              Return DirectCast(Me.ViewState("userid"), String)
          End Get
          Set
              Me.ViewState("userid") = value
          End Set
      End Property
      ' same for password
      

      Be aware, though, that the view state is not secure, i.e., it can be modified by a skilled user of your web application. Thus, be sure to validate the values of userid and password again (check the DB to see if they match) before assigning a mail address to them. (Same holds for option 1, by the way.)

    3. Save the values somewhere else, for example, in the Session.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a Django model for the following scenario: There are
I am trying to create a secure download web app with the following scenario.
I am trying to create a table with the following: CREATE TABLE GTW_WORKFLOW_MON (
Trying to create a QtRuby application, I get the following error: /usr/lib64/ruby/site_ruby/1.8/Qt/qtruby4.rb:2144: [BUG] Segmentation
Trying to create a list to return some JSON data to a view. Following
I'm trying to create an algorithm in C# which produces the following output strings:
I am trying to create an expression tree that represents the following: myObject.childObjectCollection.Any(i =>
In MySQL 5.0 why does the following error occur when trying to create a
Trying to create a user account in a test. But getting a Object reference
I have the following scenario: a table of projects and a table of persons,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.