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

  • SEARCH
  • Home
  • 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 6791861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:53:52+00:00 2026-05-26T17:53:52+00:00

i need to retrive some data from table registration of database to show.aspx page

  • 0

i need to retrive some data from table registration of database to show.aspx page after login. when i register a new user after registration and redirect it to the profile.aspx page then it works fine(showing all required data). but if i do logout and again do login to the same user then the page show.aspx show nothing

I am using this code for user login:

Protected Sub btnLogin_Click1(ByVal sender As Object, ByVal e As System.EventArgs)
    Dim admin As String = "Admin"
    Dim objcmd As New SqlCommand(("select * from Login where UserName='" + txtUserName1.Text & "' And Password='") + txtPassword1.Text & "'", con)
    Dim objReader As SqlDataReader

    con.Open()
    objReader = objcmd.ExecuteReader()
    If objReader.HasRows Then
        While objReader.Read()
            If [String].Compare(objReader("UserType").ToString(), admin) = 0 Then
                Session("UserName_Admin") = txtUserName.Text.ToString().Trim()
                Session("UserName") = txtUserName.Text.ToString().Trim()
                Response.Redirect("adminview.aspx")
            Else
                Session("UserName") = txtUserName.Text.ToString().Trim()
                Response.Redirect("show.aspx")
            End If
        End While
    Else
        lblLoginMessage.Text = "Login failed. Please try again"
    End If
    con.Close()
End Sub

code in the show.aspx page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

    If Session("UserName") Is Nothing Then

        Response.Redirect("registration.aspx")

    End If

    binddata()

End Sub
Sub binddata()

    Dim mycommand As New SqlCommand("SELECT * FROM registration where UserName = @UserName", con)
    mycommand.Parameters.AddWithValue("@UserName", Session("UserName").ToString())
    con.Open()
    ProfileData.DataSource = mycommand.ExecuteReader
    ProfileData.DataBind()
    con.Close()
End Sub
Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
    Response.Redirect("upimg.aspx")
End Sub

i am using a datalist to retrieve data from database in show.aspx page.
is there anything i need to change in web.config file . a help will be appreciated

  • 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-26T17:53:53+00:00Added an answer on May 26, 2026 at 5:53 pm

    Is your logout code clearing the session values?

    I think you would be far better off using the ASP.net Membership and Roles to handle this functionality because it will be much more secure and flexible.

    Check out here an article explaining how to get setup here

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

Sidebar

Related Questions

I need to retrieve some data from a web page. After analysing the HTML
Usually, I need to retrieve data from a table in some range; for example,
I need to access some data from an MS Access database and retrieve some
I need to get retrive all of the data from specified tables and I
I need to represent a table containing data about some tests and their results.
Essentially I need to retrieve some account information from the dbase table where they
I need to retrieve some data stored as varchar in an SQL table to
I need some help to figure this out .. I am getting data from
I need to retrieve all rows from a table where 2 columns combined are
I need to retrieve a record from a database, display it on a web

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.