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 5990169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:12:18+00:00 2026-05-22T23:12:18+00:00

I will see if I can explain this clearly enough. I have 2 web

  • 0

I will see if I can explain this clearly enough. I have 2 web forms. One is a basic Forms Authentication login page and the other form displays tasks from multiple servers. I am creating a cookie that stores the UserID. Here is the code for my cookie:

        FormsAuthenticationTicket tkt = new FormsAuthenticationTicket(1, txtUser.Text, DateTime.Now, DateTime.Now.AddMinutes(120), true, rdr.GetInt32(0).ToString(), FormsAuthentication.FormsCookiePath);
        string hash = FormsAuthentication.Encrypt(tkt);
        HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, hash);

On my other form, I have a drop down box that displays all servers by Server IP from the Servers table.

public void Populate()
        {
            SqlConnection myConnection1 = new SqlConnection(ConfigurationManager.ConnectionStrings["DBConnection"].ConnectionString);
            myConnection1.Open();

            SqlCommand cmd1 = new SqlCommand("SELECT ServerIP FROM Servers", myConnection1);
            SqlDataReader dropReader;
            dropReader = cmd1.ExecuteReader();

            drpChoose.DataSource = dropReader;
            drpChoose.DataTextField = "ServerIP";
            drpChoose.DataValueField = "ServerIP";
            drpChoose.DataBind();
        }

I am calling Populate in Page Load. I have another table that stores permissions. It has UserID, ServerID, and Permission (read or execute). Let’s say that UserID 1 is associated with only ServerID 1 which has an IP of 192.168.0.10. How can I get this one Server IP to display in the drop down? I am pretty sure if I pass the cookie into the second form that I can take the UserID from that but I do not know where to begin.

I apologize if I have not given enough information. I will provide more if need be.

  • 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-22T23:12:19+00:00Added an answer on May 22, 2026 at 11:12 pm

    Looks like you’ll need to do a join to your permissions table something like

    SELECT ServerIP from Servers s, Permissions p where p.serverid = s.serverid and p.userid = :userIdFromCookie
    

    Then you’ll need to pass in the user id from your cookie into the Populate method and use a DbParameter to pass the value into your Sql command.

    something like (this is pseudocode by the way as I’m not at my dev machine)

    cmd.AddInParameter(":userIdFromCookie",dbType.AnsiString, Request.Cookies["mycookie"]["userid"])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I think this will be easy but I can't see how to do it!
I have recently been web-researching quantum computing. Will we see these in our lifetimes
I am developing a web site and need to see how it will look
Unix.....>>netstat -al | grep 8787 (will see packets on port 8787)
I am writing a DB upgrade script that will check to see if an
Will everything go to the cloud? If so, in which direction? Google-Gears? Flash,AIR,JavaFX? See
It's common to see a UISearchBar in an application, that upon a click, will
Will limiting a query to one result record, improve performance in a large(ish) MySQL
Will I have to pay again? I have about 9 months left before renewal
I have come accross a strange problem that can be illustrated using the 2

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.