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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:29:36+00:00 2026-06-05T11:29:36+00:00

I developed very simple web site, I have onle three web pages. Logon.aspx Register.aspx

  • 0

I developed very simple web site, I have onle three web pages.

  1. Logon.aspx
  2. Register.aspx
  3. MyAccount.aspx

Logon.aspx code:

        if (ValidateUser(email, password))
        {
            FormsAuthenticationTicket tkt;
            string cookiestr;
            HttpCookie ck;
            tkt = new FormsAuthenticationTicket(1, txtUserName.Value, DateTime.Now,
                                                DateTime.Now.AddMinutes(3), chkPersistCookie.Checked,
                                                email + "@ticket");
            cookiestr = FormsAuthentication.Encrypt(tkt);
            ck = new HttpCookie(FormsAuthentication.FormsCookieName, cookiestr);
            if (chkPersistCookie.Checked)
                ck.Expires = tkt.Expiration;
            ck.Path = FormsAuthentication.FormsCookiePath;
            Response.Cookies.Add(ck);

            string strRedirect;
            strRedirect = Request["ReturnUrl"];
            if (strRedirect == null)
                strRedirect = "MyAccount.aspx";
            Response.Redirect(strRedirect, true);
        }
        else
            Response.Redirect("logon.aspx", true);

Register.aspx code:

    private bool RegisterUser(string name, string surname, string email, string phone, string pass)
    {
        SqlConnection conn = new SqlConnection(@"Data Source=Server\SQL;Initial Catalog=Db;Integrated Security=True; User ID=user; Password =pass;");
        conn.Open();
        string insertQuery = @"INSERT INTO Users (Email, Name, Surname, Phone, Manager, Rank, Password)
                                VALUES (@Email, @Name, @Surname, @Phone, @Manager, @Rank, @Password)";
        SqlCommand cmd = new SqlCommand(insertQuery, conn);

        cmd.Parameters.Add("@Email", email);
        cmd.Parameters.Add("@Name", name);
        cmd.Parameters.Add("@Surname", surname);
        cmd.Parameters.Add("@Phone", phone);
        cmd.Parameters.Add("@Manager", "Test@Test.com");
        cmd.Parameters.Add("@Rank", "1");
        cmd.Parameters.Add("@Password", pass);

        try
        {
            int rowsAffected = cmd.ExecuteNonQuery();
        }
        catch (Exception e )
        {

            throw;
        }
        finally
        {
            cmd.Dispose();
            insertQuery = string.Empty;
        }

Everything is perfect.
Now what I want is on Page_Load of MyAccount.aspx:

  1. Get cookie
  2. Check user Role
  3. Based on user Role display required web site content.

But I am not sure how to do that.

  1. Should I refer cookie to establish user role?
  2. How do I generate HTML based on user role?

Thanks!

  • 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-06-05T11:29:37+00:00Added an answer on June 5, 2026 at 11:29 am

    I don’t think you want to go generating much HTML based on role, more like you want content within your site to be only accessible to certain roles i.e. different pages and controls. This codeproject page is doing what you require.

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

Sidebar

Related Questions

Recently, I have a developed a very simple web app for a survey. I
I have a very simple windows Service that is developed in vb.net 2008. When
I have developed a simple location aware iPhone application which is functionally working very
My question is very simple: In an averagely complex web request, usually we have
I have developed a simple Apache-Axis java web service using Eclipse IDE and now
i developed a very simple vb.net application and i need a way for every
I've developed a very simple host and client which I wanted to use to
I've developed a very simple ASP.NET (jQuery) application. The RDBMS is MS Sql Server
I'm very newbie to Ubuntu OS and I have my solution developed in visual
I am very new to iPhone. I have developed two version of an application

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.