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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:00:58+00:00 2026-05-23T13:00:58+00:00

MSDN is rather vague regarding this attribute. The custom data string can be set

  • 0

MSDN is rather vague regarding this attribute.

The custom data string can be set to
any string value and is set using the
customProviderData attribute of the
add configuration element for adding
profile properties.

Which is the MSDN-esque way of saying figure it out yourself.

From the description it kind of feels like it’s plain text you just pass from web.config to a custom provider. But it’s not like that, this string seems to build the type of data a given attribute will hold, and I want to know what’s the specific format.

In particular, I have the following attributes (and a few more, but I’ll just exemplify with two)

    [SettingsAllowAnonymous(false)]
    [CustomProviderData("NotificationTypes;nvarchar;255")]
    public string NotificationTypes
    {
        get { return base["NotificationTypes"] as string ?? "Email"; }
        set { base["NotificationTypes"] = value; }
    }

    [SettingsAllowAnonymous(false)]
    [CustomProviderData("IssuesPageSize;int")]
    public int IssuesPageSize
    {
        get { return base["IssuesPageSize"] as int? ?? 10; }
        set { base["IssuesPageSize"] = value; }
    }

Here, the custom data seems to determine the name of the field, the db type, and the db length. I was wondering if this attribute could hold a default.

My questions then, are the following:

Can base[attrib] ever be null in a ProfileBase implementation?
Should I just check against 0 and string.Empty if I want to set default values?

The point being that if base[attrib] can’t ever be null, I don’t need the int? cast, and I should just be checking against 0, in that case, and against string.Empty in the previous one.

That is, unless there’s a “happier” way to set a default value, pretty much like in web.config where you just type:

<add name="NotificationTypes" type="String" defaultValue="Email" customProviderData="NotificationTypes;nvarchar;255" />

I guess I’m asking how I can add an attribute that is functionally exactly like the one in the <add/> tag above, but programatically.

  • 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-23T13:00:58+00:00Added an answer on May 23, 2026 at 1:00 pm

    Came up with adding this:

        static SharedMembershipProfile()
        {
            Properties["IssuesPageSize"].DefaultValue = 10;
            Properties["NotificationTypes"].DefaultValue = "Email";
            Properties["PreferredLocale"].DefaultValue = "en-US";
        }
    

    Still wondering if there’s a better approach, like an attribute, or something more “auto-wired”

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

Sidebar

Related Questions

It is said here http://msdn.microsoft.com/en-us/library/ee817669.aspx#observerpattern_topic3a This permits a subject to notify a potentially infinite
According to the MSDN documentation on the List<T>.Clear method : This method is an
I'm trying to follow this tutorial but with the immediate window in vs2010 rather
I was just looking at the MSDN documentation for ConcurrentDictionary , and I saw
I'm trying to get asp.net to store viewstate in the session rather than bulking
Am trying to get linq to call a stored procedure. I know this is
I've been looking at the constructors of unordered_set. Is it not possible to construct
I have a simple inheritance in my model. The class of an entity is
So I'm trying to figure out how to correctly override GetHashCode() in VB for
The following snippet does work for what I need. I believe though that there

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.