MVC :: How To Retrieve User.Identity.Name From View User Control

Jun 9, 2010

i currently work on an mvc 2 project and noticed that inside an mvc view page i can get the user name authenticated via User.Identity.Name, but if i try to use the DsiplayFor method in order to display my model from a view user control, it just does not exist. Could i pass this parameter to my model using additional ViewData parameter that comes with DisplayFor html extension?

View 2 Replies

Similar Messages:

Retrieve Web User's Identity Outside Of Request Scope?

Feb 14, 2011

I have an ASP.NET app that logs Audit reports using nHibernate's IPreUpdateListener. In order to set the current user in the Listener events, I was using System.Security.Principal.WindowsIdentity.GetCurrent(). This works fine when debugging on my machine, but when I move it to the staging server, I'm getting the ASP.NET process credentials, not the requesting user.

In the ASP.NET page, I can use Request.LogonUserIdentity (which works fine since I'm using integrated authentication), but how do I reference this user directly without having to pass it directly to my event? I don't want to have to pass this info through the pipeline because it really doesn't belong in the intermediate events/calls.

View 1 Replies

Security :: Unable To Retrieve Current.User.Identity.Name In II7

Feb 26, 2010

I'm in the middle of moving a web application from IIS6 to IIS7. I've enabled "Windows Authentication" and added <deny users="?" /> to the authorization section of my web.config file. When the app was running on IIS6 my users where able to access the web app without logging in because their windows login was automatically recognized. This does not seem to be the case in II7. I can not get a value for "Current.User.Identity.Name" in my ASP.Net code.

View 1 Replies

Security :: Select User View Only Noticesselect User View Only Logsselect User View Only Newsetc?

Feb 14, 2011

have a web in which there are different areas i have a 1 admin which manage all things like news, Events, Notices, Logs, Forums, Publications etc.........i want assign user rights that select user view only Noticesselect user view only Logsselect user view only Newsetc....

View 7 Replies

Security :: Using Page.User.Identity.Name To Fetch User Information From A MsSQL Database?

Dec 23, 2010

I have implemented Forms authentication in an ASP.NET MVC 2 website

By using <%: Page.User.Identity.Name %> on the Site.Master page I can display the userid of the logged in user.

I would like to use this value and display other information about the user that is stored in a User table in a MsSQL database, like:

<%: GetFirstname(Page.User.Identity.Name) %>

View 2 Replies

Method Is Only Supported If The User Name Parameter Matches The User Name In The Current Windows Identity?

Jan 30, 2011

get the below error. My application was working fine until I probably modified something, but don't know what.

Server Error in '/' Application.

Method is only supported if the user name parameter matches the user name in the current Windows Identity.

Description: An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Configuration.Provider.ProviderException: Method is only supported if the user name parameter matches the user name in the current Windows Identity.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[ProviderException: Method is only supported if the user name parameter matches the user name in the current Windows Identity.]
System.Web.Security.WindowsTokenRoleProvider.GetCurrentWindowsIdentityAndCheckName(String userName) +2195661
System.Web.Security.WindowsTokenRoleProvider.GetCurrentTokenAndCheckName(String userName) +36
System.Web.Security.WindowsTokenRoleProvider.GetRolesForUser(String username) +61
System.Web.Security.RolePrincipal.IsInRole(String role) +182....

View 1 Replies

DataSource Controls :: Use Dataset To Display Sum Where User= Use Gridvew, Or Formview)?

Oct 27, 2010

i want to use dataset , or any thing ... to display Sum * where user= use gridvew, or formview) because i have more then 100 columns . i m newbie. realy , 1 month, it not solve, sometime , i want to give up

View 3 Replies


Mar 2, 2010

I have created a web services (WCF) and i have a webmethod that return a string that string is a HTTPCONTEXT.USER.IDENTITY.USER unfortunately it does not return any value.

View 9 Replies

User Identity Name Showing Windows User Instead Of Network Service?

Jun 28, 2011

In the IIS, it shows that the web app (i'm using) is using an application pool that uses NETWORK SERVICE account for identity. But when I debug/run my web app, User.Identity.Name shows that my windows user login instead. I checked my web.config file, and it does not have Impersonate enabled. In fact, I set it to false, and it still shows the same.

View 1 Replies

Security :: Isolating The User Name In Page.User.Identity.Name?

Mar 4, 2010

Is there a simple way to just retrieve the user's name, and not the Domain name, when using this function:

string quizTaker = Page.User.Identity.Name.ToString();

Right now it returns "DOMAIN_NAMEUserName"

I would like to just use isolate and use the user's name, without the Domain name.

View 2 Replies

Which One Should Use For "anonymous User Identity" - "specific User: IUSR" Or "application Pool Identity"?

Feb 2, 2011

In IIS Manager center pane, there is an icon titled "Authentication" as follows: Clicking the icon, we get 3 items as follows: Right clicking the Anonymous Authentication and select edit, we have: Question: which one should I use? What is the difference?

View 3 Replies

Server Controls In User Control Are Null When User Control Serves As A Base User Control ?

Jun 4, 2010

I don't think I understand fully how ASP.NET does inheritance of controls.I have a user control, ucBase, which has an label in the ascx file. Code behind references the label and it works fine during run time if the control is not a parent for another user parent.

If I have another user control, ucChild, inheriting from ucBase, the label in ucBase's code is always null. ucChild has no controls in its ascx fileThe server controls (like the label) needs to be declared in the ascx file and not created programmatically.What needs to be done for ucBase to see its own controls when it's a parent user control?

View 1 Replies

User Controls :: Save And Retrieve CheckBoxList Values As Per User Roles?

Feb 26, 2014

i need a script on that can build this form.

1.Users === Drop Down Menu then in the Drop down should be the names of all Taafoo staff.

View 1 Replies

Data Controls :: User To User Profile View Showing Error

Apr 27, 2016

 When a user wants to view another user profile on user profile page this error will show up


Server Error in '/' Application.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:
Line 72: protected void OnDataBound(object sender, EventArgs e)
Line 73: {
Line 74: string userName = (FormView1follow.Row.Cells[0].FindControl("hfUserName") as HiddenField).Value;
Line 75: string friendsUserName = (FormView1follow.Row.Cells[0].FindControl("hfFriendsUserName") as HiddenField).Value;
Line 76: string followStatus = (FormView1follow.Row.Cells[0].FindControl("hfFollowStatus") as HiddenField).Value;


<div class="text-center">
<asp:FormView ID="FormView1follow" runat="server" OnDataBound="OnDataBound" Width="100%">
<asp:HiddenField ID="hfUserName" runat="server" Value='<%# Eval("UserName") %>' />
<asp:HiddenField ID="hfFriendsUserName" runat="server" Value='<%# Eval("FriendUserName") %>' />

[Code] .....

View 1 Replies

MVC :: Templates In 2 View User Control?

Aug 27, 2010

Is there a way to create templates in an MVC 2 View User Control much like the ability of a Web User Control? or should I just use a Web User Control? With MVC 2, should Web User Controls be avoided?

View 4 Replies

MVC :: Import View User Control?

Feb 3, 2011

I'm using the default logon/register pages in my mvc 2 project ,

I'm trying to use the same aspx page for both of them ,(logon & register ) for this perpas I have created a prtial view from the register controller and load it into the logon page, how ever when the user just click without any data in any field , I'm getting this error ,

The model item passed into the dictionary is of type 'JvTake3.Models.LogOnModel', but this dictionary requires a model item of type 'JvTake3.Models.RegisterModel'.

I would like to Emphasize that in my partial view there is :


View 13 Replies

How To Change Html View Of Web User Control

Mar 10, 2011

I am creating a web user control for a simple poll. I am currently registering it on the page and then referencing it via tagprefix.

The form for the poll is in basic html (no server controls) and is in the front-end of the web control. How can I change the look of the user control depending on the settings passed into it? Is this possible without using server controls?


Can I change the html layout of a user control?

View 3 Replies

.net Mvc View User Control For Data Capturing?

Jul 20, 2010

I am tring to add a user control to do a search. this user control is to be used on the home page and for example /category-page.where do I write the code for data capturing. is there a way to force the user control to submit to a HomeController or the controller I want?

public ActionResult Search(string key)

View 1 Replies

Mocking User.Identity In .NET MVC?

Jun 12, 2010

I need to create Unit Tests for an ASP.NET MVC 2.0 web site. The site uses Windows Authentication.I've been reading up on the necessity to mock the HTTP context for code that deals with the HttpContext. I feel like I'm starting to get a handle on the DI pattern as well. (Give the class an attribute of type IRepository and then pass in a Repository object when you instantiate the controller.)

What I don't understand, however, is the proper way to Mock the Windows Principal object available through User.Identity. Is this part of the HttpContext? have a link to an article that demonstrates this (or a recommendation for a book)?

View 2 Replies

Get The App Pool Identity User?

Nov 15, 2010

I want to get the user specified in the app pool identity (which for us is a domain user). I want to get this info in Application_Start.

View 2 Replies

Web Forms :: User Control Can't View In Design Time

Mar 30, 2010

I have the user control and web page. When I place user control in the web page and in design time, it cannot view and error is "System.Web.UI.UserControl does not have a public property named 'ContentTemplate". It seems not related of error message.

View 5 Replies

Web Forms :: How To Create Tree View Using User Control

Apr 15, 2010

i want to use the tree view for the menu,

how to create the tree view in using user control.

View 3 Replies

Can Use Web Forms (event Driven) User Control In Mvc View

Apr 28, 2010

If not what are alternatives in mvc to make reusable components? Which of those alternative is recommended to use?

View 1 Replies

Security :: What Is The Use FormsAuthentication.user.identity

Oct 7, 2010

what is the use formsAuthentication.user.identity

is it one of the property of page

View 1 Replies

C# - How To Extend The User.Identity Property

Jul 30, 2010

I'm not talking about membership.

For each logged user I want to cache some properties like status or the number of friend requests, from the db.

I can create custom class which would do it but I thought it will be better to extend the existing User.Identity property. Something like this:

Label1.Text = User.Identity.Status;

View 2 Replies

Copyrights 2005-15, All rights reserved