[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

11/09/2005 at 07:00AM PST, ID: 21624807
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.0

Forms Auth - Signoff User

Asked by sbornstein2 in Programming for ASP.NET

Tags: signoff, authentication

Hi all.  Ok I am new to forms authentication and I am trying to pull this all together.  Right now I have a login page where if the user authenticates against a SQL Database then I move on and I am setting up a Forms Auth ticket etc.  I then have pages where I want to check certain credentials and if it does not pass or if the user just hits the page without authenticating to the SQL Database I want to force them to go back to the sign off page.  How do I do this.  I am posting here what I have.  I cant seem to get my global.asax page working so I added all this into the login page.   I will also paste my web.config.  At this point I dont know what to do etc.  Once the user authenticates from the SQL Database I pass to this method here:

private void ProcessFormsAuthentication(string USER_ID)
            {
                  FormsAuthentication.Initialize();
                  string roleList = GetRoles(USER_ID);

                  // Create the authentication ticket
                  FormsAuthenticationTicket authTicket = new
                        FormsAuthenticationTicket(1,                          // version
                        USER_ID,           // user name
                        DateTime.Now,               // creation
                        DateTime.Now.AddMinutes(60),// Expiration
                        false,                      // Persistent
                        roleList);                    // User data

                  // When the ticket was created, the UserData property was assigned a
                  // pipe delimited string of role names.
                  string[] roles = authTicket.UserData.Split(new char[]{'|'});
                  
                  // Create an Identity object
                  FormsIdentity id = new FormsIdentity(authTicket);

                  // This principal will flow throughout the request.
                  GenericPrincipal principal = new GenericPrincipal(id, roles);
                  // Attach the new principal object to the current HttpContext object
                  Context.User = principal;
                  
                  // Now encrypt the ticket.
                  string encryptedTicket = FormsAuthentication.Encrypt(authTicket);
                  // Create a cookie and add the encrypted ticket to the
                  // cookie as data.
                  HttpCookie authCookie =
                        new HttpCookie(FormsAuthentication.FormsCookieName,
                        encryptedTicket);

                  // Add the cookie to the outgoing cookies collection.
                  Response.Cookies.Add(authCookie);

                  Respones.Redirect("firstpage.aspx");
            }

            private string GetRoles(string USER_ID)
            {
                  return "Senior Manager|Manager|Employee";
                  //just for testing
            }

the roles is another issue I am looking at as well but I just want to also start with checking on a page the user is authenticated and playing around with a force sign off.   Here is my Web config.  I dont have any clue how the authorization works:

      <authentication mode="Forms">
                        <forms name="CustomerSite"
                              loginUrl="\Site\Logon.aspx"
                              protection="All"
                              timeout="60"
                              path="/"
                              requireSSL="true"
                              slidingExpiration="true">
                        </forms>
            </authentication>
            
            <authorization>
                  <allow users="*" />
            </authorization>
 
Keywords: Forms Auth - Signoff User
 
Loading Advertisement...
 
[+][-]11/09/05 07:41 AM, ID: 15256948

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Programming for ASP.NET
Tags: signoff, authentication
Sign Up Now!
Solution Provided By: naveenkohli
Participating Experts: 1
Solution Grade: A
 
 
[+][-]11/09/05 08:08 AM, ID: 15257255

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/09/05 08:28 AM, ID: 15257488

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/09/05 08:39 AM, ID: 15257638

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/09/05 08:46 AM, ID: 15257719

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/09/05 08:49 AM, ID: 15257742

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/09/05 08:50 AM, ID: 15257758

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/09/05 08:58 AM, ID: 15257850

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/09/05 09:08 AM, ID: 15257942

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/09/05 09:13 AM, ID: 15257981

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/09/05 09:17 AM, ID: 15258025

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/09/05 09:19 AM, ID: 15258044

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/09/05 09:23 AM, ID: 15258083

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/09/05 09:27 AM, ID: 15258106

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20090824-EE-VQP-74