Using Web application with Profile

  • Thread starter Thread starter Oriane
  • Start date Start date
O

Oriane

Hi there,

I would like to open my Asp.Net project as a "Web Application" rather than
as a "Web Site" in Visual Studio.
But the thing is that I use the System.Web.Profile and the auto-generated
class "ProfileCommon myApp.Profile", which provides me with type profile
properties. And the fact is that this generated class is not generated with
Web app...

For ex, in the web site project, if "X" is a profile Property, I can write:
using System.Web.Profile;
....
Profile.X = "nnnn";

However I could use some code like this in the web application project:
Membership.ApplicationName = "myApp";
ProfileBase userpf = ProfileBase.Create(userName); // the current
user name
// Value ot the "X" profile property
string valeur = userpf.GetPropertyValue("X").ToString();

The thing is that I don't have the current user name, although I could save
in a hidden field for instance after the user has logged in the login page
(this is of course a form authentication app).

In that case, will it work ?

Is there anything more straightforward to convert my VStudio web site
project in a VStudio web app project ?

Regards
 
Hi Oriane,

As for using Profile in Web Application Project, the dev team do have
noticed this issue and have produced some add-on component for generating a
helper Profile class in WEb application project, you can have a look at the
"Web Profile Builder":

#Web Profile Builder
http://code.msdn.microsoft.com/WebProfileBuilder

#Web Profile Builder for Web Application Projects
http://weblogs.asp.net/joewrobel/archive/2008/02/03/web-profile-builder-for-
web-application-projects.aspx


In addition, the method you used(manually use HttpContext.Profile class to
manipulate profile) is also a good approach. And for the "Username" issue
you mentioned, I think you can use the following method to get the current
username(for the profile):

=====================
protected void Page_Load(object sender, EventArgs e)
{

Response.Write("<br/>current profile username: " +
Context.Profile.UserName);
}
==================

this works even for anonymous user(will give you the auto-generated guid
for the anonymous user).

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
 
Hi Steven,
Steven Cheng said:
Hi Oriane,

As for using Profile in Web Application Project, the dev team do have
noticed this issue and have produced some add-on component for generating
a
helper Profile class in WEb application project, you can have a look at
the
"Web Profile Builder":

#Web Profile Builder
http://code.msdn.microsoft.com/WebProfileBuilder

#Web Profile Builder for Web Application Projects
http://weblogs.asp.net/joewrobel/archive/2008/02/03/web-profile-builder-for-
web-application-projects.aspx
Thanks for your answer. However, I had a glimpse on this page:
http://weblogs.asp.net/jgalloway/archive/2008/01/19/writing-a-custom-asp-net-profile-class.aspx,
and I find this solution convenient to me.

Best regards
 
Hi Oriane,

Thanks for your followup. I'm glad that you've also found the solution and
share this with us.

Have a good day!

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
In-Reply-To: <[email protected]>
Subject: Re: Using Web application with Profile
Date: Wed, 27 Aug 2008 13:54:37 +0200
Hi Steven,
"Steven Cheng [MSFT]" <[email protected]> a écrit dans le message
de news:[email protected]...
Hi Oriane,

As for using Profile in Web Application Project, the dev team do have
noticed this issue and have produced some add-on component for generating
a
helper Profile class in WEb application project, you can have a look at
the
"Web Profile Builder":

#Web Profile Builder
http://code.msdn.microsoft.com/WebProfileBuilder

#Web Profile Builder for Web Application Projects
http://weblogs.asp.net/joewrobel/archive/2008/02/03/web-profile-builder-for-
web-application-projects.aspx
Thanks for your answer. However, I had a glimpse on this page:
http://weblogs.asp.net/jgalloway/archive/2008/01/19/writing-a-custom-asp-ne t-profile-class.aspx,
and I find this solution convenient to me.

Best regards
 
Back
Top