This means that membership and role providers are supported by auto-code-generation and profile provider is not. Why?
And if it is so, then section <properties> in <profile> section of web.config is meaningless!!! becouse only one solution is to write own profilecommon class.
This means that membership and role providers are supported by auto-code-generation and profile provider is not. Why?
Membership and Roles doesn't relies on auto code generation which is provided by VS for website project model.
Vorlosha
then section <properties> in <profile> section of web.config is meaningless!!! becouse only one solution is to write own profilecommon class.
It's not, you still have to declare the profile properties there, the only difference is that VS will not generate the ProfileCommon class for you when you use WAP.
If I define properties of ProfileCommon class in my vb-file, then if there're properties with same names in web.config file - then exception says there're aleady these properties :)))
Perhaps if I do not define properties in vb-file, then it'll work, but I didnt try
Option Strict Off
Option Explicit On
Imports System
Imports System.Web
Imports System.Web.Profile
Public Class ProfileCommon
Inherits System.Web.Profile.ProfileBase
Public Overridable Function GetProfile(ByVal username As String) As ProfileCommon
Return CType(ProfileBase.Create(username), WebApplication1.ProfileCommon)
End Function
End Class
I didn't said that you will get intellecense event if you wrote a custom class.In WAP,the Context.Profile proeprty will be of type type ProfileBase not your cutom ProfileCommon class and so you will not get intellcense till you cast it to your custom profile
class:
YourCustomProfileClass p=Context.Profile as YourCustomProfileClass;
Vorlosha
Member
34 Points
236 Posts
profile common non-existant in ASP.NET 4.0!!!!
Nov 01, 2009 10:38 AM|LINK
hi!
I had code in 3.5 web application :
Same code in .net 4.0 application under VS2010 doesn't work!
It says that ProfileCommon is undefined!
But all "imports" are the same, profile provider in web.config. is set accordingly to 3.5 aplication
so! what's with profilecommon in 4.0?
anas
All-Star
73649 Points
7914 Posts
Moderator
Re: profile common non-existant in ASP.NET 4.0!!!!
Nov 01, 2009 05:53 PM|LINK
Becuase you are using WAP project model.
ProfileCommon is not available in web application project and i'm not sure if the VWD team will support this in the RTM version of VS 2010.
It seems they will not.
see these threads for more information about WAP support for Profile class:
http://forums.asp.net/p/1259344/2353842.aspx
http://forums.asp.net/p/1373791/2881423.aspx#2881423
Vorlosha
Member
34 Points
236 Posts
Re: profile common non-existant in ASP.NET 4.0!!!!
Nov 01, 2009 07:46 PM|LINK
That's very strange!
This means that membership and role providers are supported by auto-code-generation and profile provider is not. Why?
And if it is so, then section <properties> in <profile> section of web.config is meaningless!!! becouse only one solution is to write own profilecommon class.
anas
All-Star
73649 Points
7914 Posts
Moderator
Re: profile common non-existant in ASP.NET 4.0!!!!
Nov 01, 2009 08:03 PM|LINK
Membership and Roles doesn't relies on auto code generation which is provided by VS for website project model.
It's not, you still have to declare the profile properties there, the only difference is that VS will not generate the ProfileCommon class for you when you use WAP.
Vorlosha
Member
34 Points
236 Posts
Re: profile common non-existant in ASP.NET 4.0!!!!
Nov 01, 2009 08:18 PM|LINK
You might be wrong partialy.
If I define properties of ProfileCommon class in my vb-file, then if there're properties with same names in web.config file - then exception says there're aleady these properties :)))
Perhaps if I do not define properties in vb-file, then it'll work, but I didnt try
anas
All-Star
73649 Points
7914 Posts
Moderator
Re: profile common non-existant in ASP.NET 4.0!!!!
Nov 01, 2009 08:20 PM|LINK
hmm, it may work , let me know when you try that.
But you still have the option to declare the profile properties in web.config file which is the most common way and easy to understand and maintain.
Vorlosha
Member
34 Points
236 Posts
Re: profile common non-existant in ASP.NET 4.0!!!!
Nov 05, 2009 07:56 PM|LINK
No, web.config defined properties do not work!
I have this profilecommon class
Option Strict Off Option Explicit On Imports System Imports System.Web Imports System.Web.Profile Public Class ProfileCommon Inherits System.Web.Profile.ProfileBase Public Overridable Function GetProfile(ByVal username As String) As ProfileCommon Return CType(ProfileBase.Create(username), WebApplication1.ProfileCommon) End Function End ClassAnd this web.config settings:
<profile defaultProvider="MyProvider" inherits ="WebApplication1.ProfileCommon"> <providers> <clear /> <add connectionStringName=" ... </providers> <properties> <add name="Person_ID" type="System.Int32" /> ... </properties> </profile>And no intellisence on profile properties :(((((
anas
All-Star
73649 Points
7914 Posts
Moderator
Re: profile common non-existant in ASP.NET 4.0!!!!
Nov 07, 2009 01:05 PM|LINK
I didn't said that you will get intellecense event if you wrote a custom class.In WAP,the Context.Profile proeprty will be of type type ProfileBase not your cutom ProfileCommon class and so you will not get intellcense till you cast it to your custom profile class:
YourCustomProfileClass p=Context.Profile as YourCustomProfileClass;
p.YourFirstProperty.....
read:
http://weblogs.asp.net/jgalloway/archive/2008/01/19/writing-a-custom-asp-net-profile-class.aspx
Vorlosha
Member
34 Points
236 Posts
Re: profile common non-existant in ASP.NET 4.0!!!!
Nov 07, 2009 01:24 PM|LINK
That's understandable.
But why then I need to indicate properties in web.config :)) If I may not access them without programming in my custom class? :)
anas
All-Star
73649 Points
7914 Posts
Moderator
Re: profile common non-existant in ASP.NET 4.0!!!!
Nov 07, 2009 06:40 PM|LINK
OMG, Microsoft we need intellecense suppot for WAP in VS 2010
Ok, it's up to you to delcare the profile properties or to add them from code behind.