Last post Feb 26, 2010 08:23 AM by TATWORTH
Feb 23, 2010 12:01 PM|dazy|LINK
I want to access membership and profile objects and wants to access profile properties that I have defined in my web app web.config file, from a windows service.
I have used this code
foreach (MembershipUser user
ProfileCommon userProfile = profile.GetProfile(user.UserName);
But its giving the followin errors
The type or namespace name "ProfileCommon" could not found (are you missing a using directive or an assembly reference?)
The type or namespace name "MembershipUser"
could not found (are you missing a using directive or an assembly reference?)
Anyone have any idea on how to do this?
<input id="gwProxy" type="hidden"><input onclick="jsCall();" id="jsProxy" type="hidden">
Feb 23, 2010 12:27 PMemail@example.com|LINK
You're trying to mix ASP.NET with C#.NET. Doesn't work that way.
Feb 23, 2010 01:59 PM|dazy|LINK
Then how should I write this?
Can you help me please, this is my first ever windows service I haven't created any before. So its being one week ago when I started creating this but I'm not succeded yet.
Anyhow, If anybody knows how to access asp.net registered user data in a windows service then plz tell me know as soon as possible.
P.S. I have configured asp.net membership module for my web app for which I have to create this web service. And I want to cretae a windows service to send an automatic (daily and weekly) email to all of my web app registered users.
Feb 26, 2010 08:07 AM|TATWORTH|LINK
You may be at the point where you need to change from using the built-in ASP.NET membership system. The CommonLogon module at http://commondata.codeplex.com/ is a comprehensive mechanism designed for joint intranet/extranet usage.
Before you do that, I suggest that you examine the aspnetdb and see if can get the required information from it. If not it is a simple task to get that information in the CommonLogon. It was a work of a few minutes to get:
CREATE PROCEDURE [dbo].[usp_PersonListActiveWeb] AS
-- Select list of all on Person table
-- 26Feb2010 Administrator Original coding
SET NOCOUNT ON
WHERE ActiveWeb = 1
ORDER BY Id
----------------- this is the end --------------
Feb 26, 2010 08:16 AM|TATWORTH|LINK
And for the common data solution, the data access code for query is quite simple:
#region " ListActiveWeb "
/// Select list of all on Person table
/// Done as a demo for http://forums.asp.net/p/1528930/3702581.aspx
/// <returns>dataset of Person showing </returns>
public static DataSet ListActiveWeb()
Feb 26, 2010 08:18 AM|TATWORTH|LINK
The unit test code took a minute or so to write:
#region " ListActiveWebTest "
/// Test ListActiveWeb
public void ListActiveWebTest()
var result = Person.ListActiveWeb();
Assert.IsTrue(result.Tables.Rows.Count > 0);
These functions will be in the next release of CommonData.
Feb 26, 2010 08:23 AM|TATWORTH|LINK
For the ASPNETDB database, start with a query like:
SELECT AM.Email, AU.UserName
FROM aspnet_Membership AM, aspnet_Users AU WHERE AM.UserId = AU.UserId