MVC :: Using ProfileCommon In Controller
Mar 13, 2010
I've added some custom properties via the <profile> node in the web.config. In a view, I can access the custom properties using <%= Html.Encode(Profile.CustomProperty) %> so I know the class is being automatically generated. However, in the Controller, the ProfileCommon just doesn't exist. Do I need to include a specific namespace for this to work or is it simply not supported?
View 1 Replies
Similar Messages:
Aug 4, 2010
I'd like to add some properties to logged in user. The last time I did this was a website made in VS2005 and ProfileCommon worked just fine. It seems however that this class is not included in web applications in general and .NET 4.0 in particular. I there for assume there is now a better way of doing this. Could anyone tell me what it is? In short I'd like to add PersonID to user's login to make it easy to hide information not related to that particular user by setting controllers like
if (!User.IsInRole("Administrator") {
var item = PickLists.GetPerson(User.Profile.PersonID); // or something like it
return View();
}
var item = PickList.GetPeople();
return View();
}
View 5 Replies
Feb 17, 2010
I am getting an object not instantiated error on a production environment only when trying to execute the following code.
Profile.GetProfile("username");
<profile defaultProvider="ProfileProvider" enabled="true" automaticSaveEnabled="true">
<providers> [Code]....
View 1 Replies
Feb 4, 2011
I am trying to use ProfileCommon inside a DLL. this DLL is being called by ASP.NET web application.
I am getting this:
Error 15 The type or namespace name 'ProfileCommon' could not be found (are you missing a using directive or an assembly
View 1 Replies
Dec 28, 2010
UML and Patterns: An Introduction to Object-Oriented Analysis and Design and Iterative Development, that follows the UP(Unified Process). It uses a Grasp Controller pattern to interact with domain classes by some methods like NewSale(), AddNewItemToSale() and CloseSale. In windows form, I can instantiate a object of this class in the UI and then use its methods to perform the actions. This works well in Client apps, but when I use asp.net mvc, I cannot find a way to instantiate an object (one for each user) that was always visible for a Controller (MVC). I cannot insert as an attribute inside Controller because it always create a new one.
View 1 Replies
Aug 26, 2010
een browsing the net but no luck.. I need to use the ProfileCommon but I can't reference any assemblies to use it.
View 1 Replies
Mar 6, 2011
[Code]....
In which table is stored data "dejan"?
View 2 Replies
Feb 7, 2010
I currently have a ProfileCommon enabled on my site and would like to know where I would start to transfer this ProfileCommon's context to a user's profile after he/she has logged in. Here is a snippet of how I have defined this ProfileCommon:
[Code]....
View 2 Replies
Jul 18, 2010
I added extra fields into web config like this :
<profile enabled="true">
<properties/>
<add name="FirstName" type="string"/>
<add name="LastName" type="string"/>
<add name ="HomeAddress" type="string"/>
<properties/>
View 2 Replies
Apr 16, 2010
I try to get the user profile settings with this code. But all items in it are empty, in the database they are not empty. So there is going something wrong. First of oll how can i add a provider to the ProfileCommon ? Maybe i'm there then... the usrInfo is filled well...
MembershipUser usrInfo = Membership.Providers["MyMembershipProvider"].GetUser(UserName,false);
ProfileCommon prf = (ProfileCommon)Profile.GetProfile(UserName);
LitNaam.Text = prf.Voorletters.ToString() + " " + prf.Achternaam.ToString();
View 2 Replies
Nov 6, 2010
my MVC2 delete and only my delete controller is refusing to return any class information. Its really similar to my edit function and the views are all auto-generated so I don't see the problem.
Function Delete(ByVal id As Integer) As ActionResult
View 4 Replies
Aug 16, 2010
I have a simple model where a Person has Gifts. I have a view which is a list of Gifts belonging to one Person.
My problem is with the Create action for a new Gift. I want it to default to the PersonID that we are already viewing the list of Gifts for. I tried simply passing the last PersonID (they are all the same)
Html.ActionLink("Create New", "Create", new { id = Model.Last().PersonID }) which works fine if there is already at least one Gift for that person but if this is the first Gift I don't have a value.
My Gift List controller knows the PersonID I want to pass but the view doesn't.
How do I pass this PersonID from my Gift List controller to my Gift Create controller via the Gift List view? Or is there a better way to do this?
View 2 Replies
May 30, 2010
I have a filter on my MVC web site. I display some records in a few different controller actions but when moving from one action to another I want to apply those filter values.
How can I persist values from controller to controller?
Should I use Session? TempData?
I am using Structure Map for IOC.
Maybe I could have a class that contains a Property for each Session Value that I use in my application and inject it on the controllers that need session?
View 10 Replies
Mar 14, 2011
How do you get the current action / controller name in a controller or class?
i can't show it in my view but that's not what i want.
View 1 Replies
Jul 22, 2010
C#: HomeController.vb: works fine HttpPost RsvpForm gets the object filled with user input.
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.Mvc;using RsvpInC.Models; namespace RsvpInC.Controllers{ public class HomeController : Controller { //
[code]...
View 5 Replies
Jan 24, 2011
I have a User entity and a department entity. I have a UserViewModel and DepartmentListModel which has List of departments.
UserViewModel has a property of type DepartmentListModel .
Now on user/create action I need to populate DepartmentListModel by calling DepartmentController's list action. List action returns populated DepartmentListViewModel.
From UserController how do I set DepartmentListModel ?
I tried doing so
[Code]....
But RedirectToAction returns RediretToRouteResult
View 7 Replies
Mar 11, 2010
Say I have several Areas that are baed on user roles.Differnet roles have different functionality, but also have some "shared" functionality like say "Payments"Now, I created a PaymentController (and it's views for listing, creating messages) in Shared (not an area) and it works fine.
Would it be possible (and how?) to create a PaymentsController class in one of the Areas, have that inherit the PaymentController Class in Shared?
If I can do this, I can successfully share common functionality across areas, and at the same time extend the derived controller to include some 'area specific' functionality to common shared controllers. (Such as the "REturn to xxxx" text and route of the returnurl, which are a bit more complicated than I just made it sound)
View 3 Replies
Jan 19, 2011
How can i transfer control to a controller's method from a controller's method..I am having two Controllers Home and User.. After username and password are verified inHome Controllers method , i want to show the User Controllers index page , so i have to callindex method of Home controller..How can i do it.
View 5 Replies
Nov 20, 2010
I have a View:
<div class="editor-field" id = "nick">Nick <%: Html.TextBoxFor(model => model.Nick)%><img src="/Content/Images/loading.gif" alt = "loading...."/>
<%: Ajax.ActionLink("Check", "Check", new AjaxOptions { UpdateTargetId = "check-valid", LoadingElementId = "loading"})%>
</div>
I used: Nick = ViewData.Model.Nick in ActionLink as below, but I cannot get value of Nick from View.
<%: Ajax.ActionLink("Check", "Check", new {Nick = ViewData.Model.Nick}, new AjaxOptions { UpdateTargetId = "check-valid", LoadingElementId = "loading"})%>
View 1 Replies
Sep 24, 2010
I have an edit application view, and it can be found at the following URL:
http://localhost:17262/Application/EditApplication/1
1 equals the application ID.
Also on the page I have a link that goes to another view to add an assistant for the application. I want to pass it the application ID so that the new assistant can be "linked" to this application. How would I get the value of 1 and add it to my action link? This is what I have in my HTML so far:
<%: Html.ActionLink("Add New Assistant", "Create", "Assistant", new { applicationID = "id" }, null) %>
View 1 Replies
Mar 21, 2011
I cant get to directcontroller url (I have change the routing so it will fit into my paging system but I cant fit it also to get the controller url without action (I can gethttp://localhost:51443/home/inde )but I would like to get also "clean" url like http://localhost:51443/home
[Code]...
View 6 Replies
Aug 25, 2010
I have a drop down where I want to pass the selected value I selected to the controller. How do I accomplish this?
View 2 Replies
Aug 20, 2010
I have this code in my view..
<%=Html.DropDownList("ProductTemplate",new SelectList(Model.ProductTemplate,"Value","Text"))%>
I know if this dropdownlist box is in between BeginForm submit I can able to access the value in Controller using collection["ProductTemplate"];
if it is not in my beginForm still I can able to access this selected value in controller?
View 2 Replies
Jan 7, 2011
i get an error: "The controller for path '/favicon.ico' was not found or does not implement IController"
then i thought: how does the framework know for which files it has to instantiate a controller, because the same thing is true for script, css and other files (never thought of that, but now the favicon is complaining, i was wondering....
View 3 Replies
Nov 15, 2010
I have an action:
public ActionResult Details(int? aaaID, int? bbbID)
and I am trying to route the url http://..../controller/aaa/23432 to action Details.
routes.MapRoute( "controller", // Route name "controller/aaa/{id}", // URL with parameters new { controller = "controller", action = "Details", lblID = UrlParameter.Optional } // Parameter defaults);However, the aaaID of function Details also get a null value?
View 1 Replies