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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:20:17+00:00 2026-05-20T23:20:17+00:00

Possible Duplicate: How to assign Profile values? I’m reading an ASP.NET book that says

  • 0

Possible Duplicate:
How to assign Profile values?

I’m reading an ASP.NET book that says you can’t use Profile if you select Web Application when you start a project. It only run under Web Site.

Are there any alternatives for Web Application? Or do you need to build your own Profile system.

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

    You can use the profile provider if you are using a web application instead of a web site, but out of the box from an aspx page code behind you will not be able to do Profile.MyProperty.

    This isn’t a big deal as with a little bit of effort you will be able to do something similar. The example providing in Converting a Web Site Project to a Web Application Project is a good jumping off point on how to use the profile provider with a web application.

    To summarize the Converting Profile Object Code section of the aforementioned article create a ProfileCommon class

    public class ProfileCommon
    {
        public Teachers Teachers
        {
            get
            {
                return (Teachers)
                    HttpContext.Current.Profile.GetPropertyValue("Teachers");
            }
            set
            {
                HttpContext.Current.Profile.SetPropertyValue("Teachers",value);
            }
        }
    }
    

    Then on your aspx code behind you can now do

    ProfileCommon Profile = new ProfileCommon();
    protected void Button1_Click(object sender, EventArgs e)
    {
        Teachers teachers = new Teachers();
        teachers.Add(new Teacher("scott"));
        teachers.Add(new Teacher("bob"));
        teachers.Add(new Teacher("paul"));
    
        Profile.Teachers = teachers;    
    }
    

    An alternative to instantiating the ProfileCommon as a field for each page would be to make it and its methods static and just call the class properties from the code behinds Profile.Teachers

    public static class Profile
    {
        public static Teachers Teachers
        {
            //......
        }
    }
    

    This isn’t a huge advantage, but makes your code more similar to that of a ASP.NET Web Site project.

    Editorial Commentary not pertinent to the answer
    There are key differences between the two project types, but for my projects I prefer web applications. I have a bias because creating a build profile for the TFS Build Manager is much easier for Web Application projects than it is for Web Site projects. Further it seems like Microsoft emphasized Web Site projects and then backed away from them in favor of Web Application projects.

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

Sidebar

Related Questions

Possible Duplicate: How to assign Profile values? I'm using ASP.NET MVC and the Membership
Possible Duplicate: How do I assign by “reference” to a class field in c#?
Possible Duplicate: Idiomatic object creation in ruby Sometimes it's useful to assign numerous of
Possible Duplicate: declare property as object? in java you can create an object directly
Possible Duplicate: How do I do multiple assignment in MATLAB? When dealing with cell
Possible Duplicate: What does the explicit keyword in C++ mean? explicit CImg(const char *const
Possible Duplicate: Specify Command for MenuItem in a DataTemplate I have a collection of
Possible Duplicate: iphone tab bar controller and core data In Xcode, I'd like to
Possible Duplicate: Is it possible to create a new operator in c#? I love
Possible Duplicate: Should a function have only one return statement? Hello, gcc 4.4.4 c89

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.