CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: Date Entered: 3/30/2006 10:19:05 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 10 Views: 227 Favorited: 0 Favorite
11 Items, 1 Pages 1 |< << Go >> >|
triadfate
Asp.Net User
The name 'Profile' does not exist in the current context3/30/2006 10:19:05 PM

0

Basicly, I'm trying to create a custom base page and inherit it to all of my aspx pages. I'm getting the above error:

The name 'Profile' does not exist in the current context

 

The custom base page looks like this:

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.Profile;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Text;

/// <summary>
/// Summary description for ManagePage
/// </summary>

    public class ManagePage : System.Web.UI.Page
    {
        protected void Page_PreInit(Object sender, EventArgs e)
        {
            //define skin.
            MasterPageFile = Profile.Master;           
        }
    }

 And an example of an aspx page, looks like this:

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Text;

public partial class home : ManagePage
{
    protected void Page_Load(object sender, EventArgs e)
    {       
        KFD.DataLayer dl = new KFD.DataLayer();
        litInfoUpdates.Text = dl.GetInfoUpdates();
    }
}

 I'm new to using aspx like this so I'm not sure if the Profile object is getting built after the base class tries to evaluate, or if I'm making a simple mistake some where. Any assistance would be appreciated.
pkellner
Asp.Net User
Re: The name 'Profile' does not exist in the current context3/31/2006 6:36:55 AM

0

are you looking for:

HttpContext.Current.Profile


Peter Kellner
http://73rdstreet.com and blogging at
http://PeterKellner.net
MVP, ASP.NET
triadfate
Asp.Net User
Re: The name 'Profile' does not exist in the current context3/31/2006 4:54:50 PM

0

I believe so, yes. Should I explictly sate it as such?
triadfate
Asp.Net User
Re: The name 'Profile' does not exist in the current context3/31/2006 5:07:18 PM

0

http://msdn2.microsoft.com/en-us/library/2y3fs9xs(VS.80).aspx

 

this is what I'm refering to. which I believe is HttpContext.Profile

pkellner
Asp.Net User
Re: The name 'Profile' does not exist in the current context3/31/2006 5:08:21 PM

0

that is how I reference Cache in my app.

Peter Kellner
http://73rdstreet.com and blogging at
http://PeterKellner.net
MVP, ASP.NET
triadfate
Asp.Net User
Re: The name 'Profile' does not exist in the current context3/31/2006 5:09:59 PM

0

I did explictly state it, and it's no longer out of context. However, I can not access the custom varaibles associated with the current profile.

It's like the actually profile object isn't being built yet.

pkellner
Asp.Net User
Re: The name 'Profile' does not exist in the current context3/31/2006 7:17:02 PM

0

are you trying to get the membership info?

Here is some sample code that works for me in my page_unload event.

 protected void Page_UnLoad(object sender, EventArgs e)
    {
        string urlReferrer = string.Empty;
        string userAgent = string.Empty;
        string userHostName = string.Empty;
        string userHostAddress = string.Empty;
        string userPrimaryLanguage = string.Empty;
        string sessionId = string.Empty;
        if (HttpContext.Current.Request.UrlReferrer != null)
        {
            urlReferrer = HttpContext.Current.Request.UrlReferrer == null ? string.Empty : HttpContext.Current.Request.UrlReferrer.ToString();
            userAgent = HttpContext.Current.Request.UserAgent == null ? string.Empty : HttpContext.Current.Request.UserAgent.ToString();
            userHostName = HttpContext.Current.Request.UserHostName == null ? string.Empty : HttpContext.Current.Request.UserHostName.ToString();
            userHostAddress = HttpContext.Current.Request.UserHostAddress == null ? string.Empty : HttpContext.Current.Request.UserHostAddress.ToString();
            userPrimaryLanguage = HttpContext.Current.Request.UserLanguages == null ? string.Empty : HttpContext.Current.Request.UserLanguages[0].ToString();
            sessionId = Session.SessionID.ToString();
        }

        string userName = string.Empty;
        if (IsPostBack)
        {
            userName = "PostBack";
        }
        else
        {
            userName = string.Empty;
        }

        utils.LogPageLoadTime(startTime, "Default.aspx", userName,
            urlReferrer, userAgent, userHostName, userHostAddress, userPrimaryLanguage,sessionId);

    }



Peter Kellner
http://73rdstreet.com and blogging at
http://PeterKellner.net
MVP, ASP.NET
triadfate
Asp.Net User
Re: The name 'Profile' does not exist in the current context3/31/2006 7:36:39 PM

0

It's nearly the same as membership. What I've discovered, however, is you can't access it from a custom base class. It has to be used on the actuall aspx page. It all has to do with when the user gets athunticated (I'm using integrated auth). If the user hasn't been athunticated it can't find the Profile for that user yet.

I tried a work around, all be it a little odd, but I didn't like the results. You can create an new aspx page remove all the code from the .aspx except for the necessary header and apply the code you want to happen on every page to the codebehind. Then in the code behind of all the other aspx pages inherit the codebehind you just created. This will let you use the Profile object (created by ProfileCommon after athuntication takes place) in a "base page" you can inherit.

The down side is you have to remove the reference to the MasterPageFile from your aspx pages or else it will overwrite what your inheriting from the "base page" you just created. This, of course, causes errors during build and is quite annoying.

I just wish there was a way to get this to work from a base class normally but I haven't been able to figure it out yet.

triadfate
Asp.Net User
Re: The name 'Profile' does not exist in the current context3/31/2006 9:54:01 PM

0

http://www.odetocode.com/Articles/440.aspx

The above site answers ALL the questions I had in regards to Profiles. In fact it is a very handy article if you ever intend on using Profiles I suggest you read it.

The solution to my issue basicly looks like this:

using System;
using System.Web;
using System.Web.UI;

/// <summary>
/// Summary description for ManagePage
/// </summary>


public class ManagePage : Page
{
    public ManagePage()
    {
        PreInit += new EventHandler(ManagePage_PreInit);
    }

    void ManagePage_PreInit(object sender, EventArgs e)
    {
        ProfileCommon profile = HttpContext.Current.Profile as ProfileCommon;
        profile.Master = "/skin/Basic/default.master";
        MasterPageFile = profile.Master;
    }
}

 
pkellner
Asp.Net User
Re: The name 'Profile' does not exist in the current context3/31/2006 9:54:48 PM

0

I have to admit I always use forms authentication, but that being said, here is an example of using Profile in the updatemethod of the ObjectDataSource.  (You can generate your own on my web site at http://painfreeods.peterkellner.net

 [DataObjectMethod(DataObjectMethodType.Update, true)]
public void Update(string userName, string email,bool isLockedOut,
bool isApproved, string comment, DateTime lastActivityDate, DateTime lastLoginDate
,string firstName,string lastName,bool advancedMode,string address_Street,string address_City,string address_State,string address_Zip
)
{
bool dirtyFlagMu = false;

MembershipUser mu = Membership.GetUser(userName);

ProfileCommon pc = (ProfileCommon)ProfileBase.Create(mu.UserName, true);
pc.FirstName = firstName;
pc.LastName = lastName;
pc.AdvancedMode = advancedMode;
pc.Address.Street = address_Street;
pc.Address.City = address_City;
pc.Address.State = address_State;
pc.Address.Zip = address_Zip;
pc.Save();

if (mu.IsLockedOut && !isLockedOut)
{
mu.UnlockUser();
}

if ( string.IsNullOrEmpty(mu.Comment) || mu.Comment.CompareTo(comment) != 0)
{
dirtyFlagMu = true;
mu.Comment = comment;
}

if (string.IsNullOrEmpty(mu.Email) || mu.Email.CompareTo(email) != 0)
{
dirtyFlagMu = true;
mu.Email = email;
}

if (mu.IsApproved != isApproved)
{
dirtyFlagMu = true;
mu.IsApproved = isApproved;
}

if (dirtyFlagMu == true)
{
Membership.UpdateUser(mu);
}
}




Peter Kellner
http://73rdstreet.com and blogging at
http://PeterKellner.net
MVP, ASP.NET
triadfate
Asp.Net User
Re: The name 'Profile' does not exist in the current context3/31/2006 9:58:40 PM

0

haha, yeah, my response hasn't posted yet but I just saw your response. I basicly did the same thing, as you should see in the code. My major issue was I didn't know enough about the Profile object, how and when it was getting generated.

But, I have it under control now. Thank you very much for your time in this. It was starting to drive me mad, lol.

11 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
ASP.NET 2.0 website programming: problem-design-solution Authors: Marco Bellinaso, Pages: 576, Published: 2006
NetWare answers: certified tech support Authors: James Nadler, Don Guarnieri, Pages: 225, Published: 1994
SharePoint 2007 user's guide: learning Microsoft's collaboration and ... Authors: Seth Bates, Tony Smith, Pages: 407, Published: 2007
Classic shell scripting Authors: Arnold Robbins, Nelson H. F. Beebe, Pages: 534, Published: 2005
NetWare administration: NetWare 4.0-6.0 Authors: Mark W. Foust, Pages: 742, Published: 2001
Handheld and ubiquitous computing: First International Symposium, HUC'99 ... Authors: Hans-W. Gellersen, Pages: 390, Published: 1999

Web:
The name 'Profile' does not exist in the current context - ASP.NET ... The name 'Profile' does not exist in the current context. The custom base page looks like this: using System; using System.Data; ...
The name 'Profile' does not exist in the current context in VS2008 ... ... so I get the "The name 'Profile' does not exist in the current context" error message everytime I try to build the solution. ...
ASP.NET 2.0 Profile Feature - ScottGu's Blog For one the 'Profile' class does not show up in the intellisense. I always get the error : 'The name 'Profile' does not exist in the current context ' ...
The name 'Profile' does not exist in the current context The name 'Profile' does not exist in the current context. I might be missing out on how/when the Profile object is getting built but I was ...
Visual Studio .NET "The name 'Profile' does not exist in the current Net 2.0 via VS2005, I'm trying to use the profile properties, ... to compile: " The name 'Profile' does not exist in the current context" the ...
The name 'Bind' does not exist in the current context - ninject ... Bind().To(); //Compiler Error: "The name 'Bind' does not exist in the current context" } }. } What could be going wrong here? ...
ASP.NET - CS0103: The Name 'context' Does Not Exist In The Current ... Jan 17, 2009 ... NET - CS0103: The Name 'context' Does Not Exist In The Current Conte. ... End public AppEnv(). User is offline Profile Card · PM ...
The name 'srvr' does not exist in the current context - C# The name 'srvr' does not exist in the current context - C# Community and ... curt22. View Public Profile · Send a private message to curt22 ...
The name 'Session' does not exist in the current context (ASP.NET ... By Andrew Pociu (View Profile) .... It doesnot work 4 me :( HttpContext.Current. Session["variable name"]; does not even exist!!! by shc on Tuesday, March 3rd 2009 at 09:16 PM. This works well for me. HttpContext.Current. ...
The name 'methodname' does not exist in the current context C# Friends Having enterd the method in the event handler in form.cs I get an error saying: The name 'methodname' does not exist in the current context. ...

The name 'Profile' does not exist in the current context in VS2008 ... The name 'Profile' does not exist in the current context in VS2008, > ROOT > NEWSGROUP > Asp.Net Forum > general_asp.net.security, ...
control does not exist in the current context - ng.asp-net-forum ... But when I run it, it says: The name 'ddlStudentServices' does not exist in the current context. Does anyone know why? ...
The name 'Profile' does not exist in the current context - ng.asp ... The name 'Profile' does not exist in the current context, > ROOT > NEWSGROUP > Asp.Net Forum ...
new TableProfileProvider error with type="Microsoft.Samples ... SqlTableProfileProvider.cs(75,36): error CS0103: The name ' SqlStoredProcedureProfileProvider' does not exist in the current context ...
Accessing Membership/Profile outside of Web App - ng.asp-net-forum ... The name 'HttpContent' does not exist in the current context. Does anyone know how I can get to my membership/profile info from a console app or class ...
Master Page Login Status not Closing window onloggingout - ng.asp ... All the following code does is doing a post back and refreshing the page. ... The name 'ClientScript' does not exist in the current context. ... CodeProject: Member Profile: Anuj kumar. Free source code and . ...
LoginName and Profile properties - ng.asp-net-forum.security The name 'Profile' does not exist in the current context in VS2008 ... LoginName and Profile properties - ng.asp-net-forum.security I found it on accident . ...
unhandled win32 exception. & no debugger error - ng.asp-net-forum ... CS0103: The name 'Settings' does not exist in the current context ... unhandled win32 exception. & no debugger error · filterable ...
Please help me to solve the following error message. - ng.asp-net ... The name 'ProfileCommon' does not exist in the current context. Following is my codes. CreateUser.aspx.cs // Create an empty Profile for the newly created ...
Problems with Using Templates in createuserwizard - ng.asp-net ... Text; Profile.Address = textbox2.Text; Profile.Save(); } Error 2 The name ' textbox2' does not exist in the current context ...

Videos:
ELCA Identity 2006 Synod Assembly Video ELCA Identity: 2006 Synod Assembly Video In “ELCA Identity” Presiding Bishop Mark S. Hanson explores what it means to be the Evangelical Lutheran ...
Developer Sandbox Interviews: Ning Watch interviews from the conference floor at the 2009 Google I/O Developer Sandbox. Developers chat with us on their apps and share technical as ...
www.moldytoaster.com as spam +1 Good comment Poor comment Reply See assholes like you prove what I just said. You can't really answer me, so instead you reply with ...
Generating Trading Agent Strategies Google TechTalks January 17, 2006 Daniel M. Reeves Daniel Reeves recently completed his PhD in Computer Science at the University of ...
Google Internet Summit 2009: Security Session Google Internet Summit 2009: The State of the Internet May 5, 2009 Security Session panelists are Whit Diffie, Steve Crocker, Chris DiBona ...
Keynote with Kyle Ford - HighEdWeb 2008 Conference HighEdWeb 2008 Conference keynote by Kyle Ford, director of product marketing at Ning, Inc., and previously the associate product manager at Yahoo ...
CONNECT Solution and Core Services Overview More info at http://healthit.hhs.gov Comments on this video are allowed in accordance with our comment policy: http://www.newmedia.hhs.gov ...
www.moldytoaster.com ment Reply that is not true. You have to look at the context of everything. In the Vietnam war, President JFK said to kill all the vietnamese ...
Connect Architecture Overview More info at http://healthit.hhs.gov Comments on this video are allowed in accordance with our comment policy: http://www.newmedia.hhs.gov ...
www.moldytoaster.com d killed all of them ! The cheeky cunt even says he? is in his home county! kill all the pakis before they rules out country THIS IS ENGLAND NOT ...












navigation - go back

file download - checking if file in use

how to map two folders?

1.x 2.0 in the main page

mail sending error

insert euro values in textbox

my local physical path

customvalidator fires but did not hold back unwanted action.

custom 404 error pages beyond root directory

problem after instalation of .net

how to get a page variable in a user control

i need .net framework concept

gridview problem

using vs 2005 to work on asp.net 1.1 site?

a namespace does not directly contain members such as fields or methods - datagrids

where to start?

not able to delete a file that is under processing

find ojbect in list(of object)

is there something like jstl in .net?

what is onserverclick?

http/1.1 500 server error

disconcerting js debug behavior

where to find code projects?

problem writing to aspx file

restarting a service from an onclick event

need advice - how to design my app

how to catch usercontrol's event?

database is not storing data

cannot use variable both within and outside a method

handling 'undeliverable' emails

help with vb.net replace command...

not able to debug my application

screen scrape problems - need to include asp code on asp.net pages

running long process in background

form only inserts first selected item in databound checkboxlist

default values for sql server in sprocs

complicated dynamic controls problem and viewstate in web user control

generating password?

repeater control with database

queue collection - disqueue item

asp .net

removing rows from a datatable

reading from a file

event handling - page load vs button click

object reference not set to an instance of an object

autopostback problem, always "one step behind"

edit data with c#

listbox help.....

asp.net vb in html body error

asp.net & javascript

 
Search This Site:

 
  Privacy | Contact Us
All Times Are GMT