Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

This property cannot be set for anonymous users.

$
0
0
I'm starting to learn c# and asp.net, because I want to start a career around it. I know it's ambitious, however I really want it. I've tried fixing it by myself, debugging (?) and googling for answers.

Here is the cs file:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class ProfileObject : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Profile.Preferences.Theme = "Retro";
        this.LiteralTheme.Text = Profile.Preferences.Theme;
    }
}



The aspx file:
<%@ Page Language="C#" Debug="true" AutoEventWireup="true" CodeFile="ProfileObject.aspx.cs" Inherits="ProfileObject" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <h1> Profile object </h1>
        Your selected theme:
        <asp:Literal ID="LiteralTheme" runat="server"></asp:Literal>

    </div>
    </form>
</body>
</html>




The error is:
Server Error in '/' Application.
This property cannot be set for anonymous users.
Exception Details: System.Configuration.Provider.ProviderException: This property cannot be set for anonymous users.


Hmm the problem is that I cannot make it work. Googling it tells me I need to set the database first. However I haven't set up any mysql or anything of the sort rather, I just want to learn about profile objects.

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>