473,705 Members | 2,421 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using Web application with Profile

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.Prof ile and the auto-generated
class "ProfileCom mon 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.Prof ile;
....
Profile.X = "nnnn";

However I could use some code like this in the web application project:
Membership.Appl icationName = "myApp";
ProfileBase userpf = ProfileBase.Cre ate(userName); // the current
user name
// Value ot the "X" profile property
string valeur = userpf.GetPrope rtyValue("X").T oString();

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

Aug 26 '08 #1
3 3438
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/arc...e-builder-for-
web-application-projects.aspx
In addition, the method you used(manually use HttpContext.Pro file 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(objec t 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:
ms****@microsof t.com.

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#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/...tance&ln=en-us.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>From: "Oriane" <or****@noemail .noemail>
Subject: Using Web application with Profile
Date: Tue, 26 Aug 2008 18:56:28 +0200
>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.Prof ile and the auto-generated
class "ProfileCom mon 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.Prof ile;
...
Profile.X = "nnnn";

However I could use some code like this in the web application project:
Membership.Appl icationName = "myApp";
ProfileBase userpf = ProfileBase.Cre ate(userName); // the current
user name
// Value ot the "X" profile property
string valeur = userpf.GetPrope rtyValue("X").T oString();

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

Aug 27 '08 #2
Hi Steven,
"Steven Cheng [MSFT]" <st*****@online .microsoft.coma écrit dans le message
de news:$H******** *****@TK2MSFTNG HUB02.phx.gbl.. .
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/arc...e-builder-for-
web-application-projects.aspx
Thanks for your answer. However, I had a glimpse on this page:
http://weblogs.asp.net/jgalloway/arc...ile-class.aspx,
and I find this solution convenient to me.

Best regards

Aug 27 '08 #3
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:
ms****@microsof t.com.

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: "Oriane" <or****@noemail .noemail>
References: <OI************ **@TK2MSFTNGP03 .phx.gbl>
<$H************ *@TK2MSFTNGHUB0 2.phx.gbl>
>In-Reply-To: <$H************ *@TK2MSFTNGHUB0 2.phx.gbl>
Subject: Re: Using Web application with Profile
Date: Wed, 27 Aug 2008 13:54:37 +0200
>
Hi Steven,
"Steven Cheng [MSFT]" <st*****@online .microsoft.coma écrit dans le
message
>de news:$H******** *****@TK2MSFTNG HUB02.phx.gbl.. .
>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/arc...e-builder-for-
>web-application-projects.aspx
Thanks for your answer. However, I had a glimpse on this page:
http://weblogs.asp.net/jgalloway/arc...-custom-asp-ne
t-profile-class.aspx,
>and I find this solution convenient to me.

Best regards

Aug 28 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2233
by: Rujuta Gandhi | last post by:
Hi All, I am facing a very crucial problem. Im developing a web application using .net studio 2005(beta). I want my Login.aspx page to be secured(https) for encrypted login information transfer. I modified web.config and properties of Login page from IIS server. And now when ever the execution is redirected to Login.aspx It is having https as its protocol.
0
2184
by: Rodusa | last post by:
I am trying to replace cookies with the new "Asp.net 2.0 profiles" in my shopping cart application, but I am having trouble to access profile properties using HttpContext.Current.Profile. I can access any other property property of this class from a regular aspx page, but not from inside the class itself. This is the piece of the code that I am trying to get to work which can also be located at the bottom of the page, but so far just...
5
3729
by: Lynne | last post by:
I apologize in advance for the lengthy message but wanted to include as much information as possible. Any insight/assistance would be appreciated. The following line of code throws an error when I execute my application using the output generated from a web deployment project. I have specified "merge all outputs to a single assembly." If I use the "publish web site" option, the application works fine. If I run the application within...
0
1066
by: Brent Borovan | last post by:
Hello, We have an ASP.NET application which uses the new Profile feature of ASP.NET 2.0 to maintain user profile information. As part of the software system we are developing, we need to access the profile information from a separate Windows application and/or service. The Profile is a part of the System.Web name space and we are not sure how to go about accessing the profile data from non-web applications. Anyone have any advice on...
2
1413
by: Matt | last post by:
Hi, I was trying to setup a Profile in my test ASP.NET application and for some reason I cannot get the Profile object to become available in my web page. If I download a sample using the profile everything works fine but if I create a new web app and copy the information from the web.config of the working sample and create my page and create the contents just like the sample, the Profile object never shows itself. Does anyone have any ideas...
2
1592
by: nathan.haywood | last post by:
I saw several posts, but no real answers about this. I've been playing with the Profile classes in a sample Web Site, but cannot seem to get the Profile to work in my actual Web Application Project. I am able to add profile properties and/or profile inheritence to the web.config, but IntelliSense never kicks in on any of my pages or code-behinds. When I type Profile, it looks like I may be getting the System.Web.Profile namespace instead...
1
2526
by: Mike | last post by:
Hi: I have been trying to create a web application that provides suport for two membership/profile databases: one for private users and one for another set of users. These tw user have a totally different set of profile attributes. I added the following code to my web.config (under system.web): <membership defaultProvider="PortalMembershipProvider">
2
1808
by: =?Utf-8?B?RGFtaWVu?= | last post by:
Hi, I'm creating an ASP.NET Web Application in vs 2005 (VB) and need to get the location of the users User profile. The code below works... Environment.ExpandEnvironmentVariables("%UserProfile%")) ...But when you upload the website onto the server it retrieves the servers user profile location and not the users. Is there anyway to retrieve the user profile of a given user?
1
2111
by: mary mathews | last post by:
Hi, I'm getting an exception while tried to retrive an outlook contact using asp.net in a console application. The exception is as follows: An unhandled exception of type 'System.NullReferenceException' occurred in ConsoleApplication1.exe,Additional information: Object reference not set to an instance of an object .. Can anybody help me pls.... my code is like this..
0
8767
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9273
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9136
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6605
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5933
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4439
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4703
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3137
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2081
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.