Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Professional ASP.NET 4 : in C# and VB
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Professional ASP.NET 4 in C# and VB by Bill Evjen, Scott Hanselman, Devin Rader; ISBN: 9780470502204
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 1st, 2012, 08:11 AM
Authorized User
Points: 51, Level: 1
Points: 51, Level: 1 Points: 51, Level: 1 Points: 51, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jul 2011
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Post Anonymous Identification not working

Hi there, yesterday I tried the example in Listing 14-10 and it showed the GUID for .ASPXANONYMOUS cookie in fiddler. Yesterday it also showed the profile information that was stored in the database in the response webpage.

But today when I executed the same program, its showing message "You must be authenticated!" which must be because Page.User.Identity.IsAuthenticated returned true as can be seen from the code. Also the header now doesnt show the cookie.

When I remove anonymousIdentification property from the web.config and set authentication mode to Windows in web.config then it responds correctly.

I also tried it on my desktop, no difference.

Please help. Now I am unable proceed for remaining chapter.

Also tell me what sets property Page.User.Identity.IsAuthenticated.

One more question: Where these information is stored by default? Can we see it through SQL Server Management Studio?

I yesterday changed the default database to one empty database I created through aspnet_regsql.exe. I was able to see the stored information in Management Studio. But I was unable to see the same with default settings.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Personalization.aspx.cs"
    Inherits="Personalization" %>

<script runat="server">
    protected void Button1_Click(object sender, EventArgs e)
        if (Page.User.Identity.IsAuthenticated)
            string oldFirstName,oldLastName,oldAge,oldMember,oldLastVisited;
            oldFirstName = Profile.GetPropertyValue("FirstName").ToString();
            oldLastName = Profile.GetPropertyValue("LastName").ToString();
            oldAge = Profile.GetPropertyValue("Age").ToString();
            oldMember = Profile.GetPropertyValue("Member").ToString();
            oldLastVisited = Profile.GetPropertyValue("LastVisited").ToString();
            Profile.FirstName = TextBox1.Text;
            Profile.LastName = TextBox2.Text;
            Profile.Age = TextBox3.Text;
            Profile.Member = Radiobuttonlist1.SelectedItem.Text;
            Profile.LastVisited = DateTime.Now.ToString();         
            Label1.Text = "Stored information includes:<p>" +
            "First name: " + Profile.FirstName +
            "<br>Last name: " + Profile.LastName +
            "<br>Age: " + Profile.Age +
            "<br>Member: " + Profile.Member +
            "<br>Last visited: " + Profile.LastVisited+
            "<br/><br/> <b>     Latebound</b> Old Personalization Information"+
            "<br/>First name: "+oldFirstName+
            "<br/>Last Name: "+oldLastName+
            "<br/>Age: "+oldAge+
            "<br/>Member: "+oldMember+
            "<br/>Last visited: "+oldLastVisited;
            Label1.Text = "You must be authenticated!";
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Storing Personalization</title>
    <form id="form1" runat="server">
        First Name:
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></p>
        Last Name:
        <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox></p>
        <asp:TextBox ID="TextBox3" runat="server" Width="50px" MaxLength="3"></asp:TextBox></p>
        Are you a member?
        <asp:RadioButtonList ID="Radiobuttonlist1" runat="server">
            <asp:ListItem Value="1">Yes</asp:ListItem>
            <asp:ListItem Value="0" Selected="True">No</asp:ListItem>
        <asp:Button ID="Button1" runat="server" Text="Submit" OnClick="Button1_Click" />
    <hr />
        <asp:Label ID="Label1" runat="server"></asp:Label></p>
<?xml version="1.0"?>
				  For more information on how to configure your ASP.NET application, please visit
    <compilation debug="true" targetFramework="4.0"/>
        <add name="FirstName"/>
        <add name="LastName"/>
        <add name="LastVisited"/>
        <add name="Age"/>
        <add name="Member"/>
        <add name="Cart" type="ShoppingCart" serializeAs="Binary"/>
    <authentication mode="Windows" />    
    <anonymousIdentification enabled="true" />     
    <remove name="LocalSqlServer"/>
    <add name="LocalSqlServer" connectionString="Data Source=localhost;Initial Catalog=AspNetServicesDB;Integrated Security=True" providerName="System.Data.SqlClient"/>
  </connectionStrings> -->

Last edited by Mahesha999; January 1st, 2012 at 08:14 AM..

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Working with Queries and Anonymous Types guynorton ASP.NET 3.5 Basics 1 October 10th, 2010 03:12 AM
About Anonymous Identification Lee Dumond BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 15 December 14th, 2008 05:12 PM
Regarding uniquely identification of every struts vishal_java2 Struts 0 April 11th, 2006 02:45 AM
Regarding uniquely identification of every struts vishal_java2 Struts 0 April 11th, 2006 02:42 AM
Session not working for Anonymous users songsan General .NET 0 January 4th, 2005 02:57 PM

All times are GMT -4. The time now is 12:23 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.