Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ProfileProvider with Windows Authentication

Status
Not open for further replies.

DTaylorAtWork

Technical User
Jul 12, 2007
11
CA
I have an existing ASP.NET 2 webpage using Windows Authentication. I'd like to set up a custom Profile Provider so I can stop storing all the user information in sessions.

I have created the class FormsProfileProvider (it's for an online form site) and it inherits from ProfileProvider. I've only bothered to overload the Get and Set PropertyValues methods for now; the rest just thrown "Not Implemented" exceptions.

I've set up my web.config to use the provider like this:
Code:
<profile defaultProvider="FormsProfileProvider" enabled="true">
	<providers>
		<clear/>
		<add name="FormsProfileProvider" type="FormsProfileProvider"
			 ApplicationName="OnlineForms" ConnectionStringName="ConnString"/>
	</providers>
	<properties>
		<add name="FullName" provider="FormsProfileProvider" type="string"/>
		<add name="Admin" provider="FormsProfileProvider" type="bool"/>
		<add name="Reporting" provider="FormsProfileProvider" type="bool"/>
		<add name="LastActivityDate" provider="FormsProfileProvider" type="DateTime"/>
		<add name="LastUpdatedDate" provider="FormsProfileProvider" type="DateTime"/>
	</properties>
</profile>

But when I debug the code my GetPropertyValues method never fires and the HttpContext.Current.Profile object is of type ProfileCommon but all of my custom properties give the exception "The method or operation is not yet implemented".

I've tried setting up a Membership Provider but it wouldn't fire the Validate User method until I tried forms authentication and even then my profile didn't work.

The other problem I have is when I try to just use Profile.Admin it gives me "The name 'Profile' does not exist in the current context"

Can someone help me out?
 
Having never done this myself I may not be best placed to advise on what is wrong, but I've just had a read of this article and it seems like what you've done should be correct (i.e. you just specify the defaultProvider). However, that article does go into good detail on how to do it and it includes a sample at the end of it so it may be worth you following the walk-through and looking at the sample application to see if there are any steps you have missed.


-------------------------------------------------------

Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]
[URL unfurl="true"]http://mdssolutions.co.uk[/url] - Delivering professional ASP.NET solutions
[URL unfurl="true"]http://weblogs.asp.net/marksmith[/url]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top