.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Master Page User.Identity.Name problem

Posted By:      Posted Date: October 01, 2010    Points: 0   Category :ASP.Net

Hello I've written some code to check information based on the authenticated user. The following code works on an ASPX page load but fails when I move into a Master Page. Specifically, the error is "Compiler Error Message: BC30451: Name 'User' is not declared."  

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load


' Get & split Domain user Information

Dim strDomainUser As String = User.Identity.Name

View Complete Post

More Related Resource Links

Problem with master page and update panel (I think)



the app I am working with is made up of three nested master pages that have the following design:

The first master page ha only realize the HEADER, BODY and FOOTER divs.

The second one specialize the Body content placeholder and divide it in three more layers: NAVIGATOR, PAGE TITLE, BODY CONTENT.

The final layer specialize the BODY CONTENT in PAGE CONTENT and ACTIONS.

In one of my content pages I have (inside the PAGE CONTENT area) 

  • 1 Update Panel that contains a gridview object
  • 1 Update Panel that contains some HTML code to show in a PopupModalExtender

The PopupModalExtender can be either triggered from inside the gridView and also from a series of LinkButtons that are in the ACTIONS area.

The problem is that when the PopupModalExtender shows the FOOTER and the ACTIONS areas are not dimmed from the style I apply as background to the modal popup. An example of what I am trying to explain can be viewed in the following screenshot.

Why this is going to happen? Has anybody any suggestion on how to solve this problem?

Thanks a lot

How show the computer user into a label in a master page

  Hello all, I'm creating a web site and I have this question, I installed a label with the name Userlbl in the master page, and the idea that I have, is when somebody opens the website, the label shows the computer's user, in my case Welcome: "Charly_csh" I tried with this code, that I used before in access and it works, when I load the page on the localhost, but when I load on the server, it shows NETWORK SERVICE The code is this: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Userlbl.Load Dim wshNetwork As Object 'New wshNetwork wshNetwork = CreateObject("WScript.Network") Me.Userlbl.Text = wshNetwork.UserName wshNetwork = Nothing End Sub Does somebody have an idea???       

JQuery(Effects problem) With Master Page

HI friends, My project is old one it is bulit in VS2005 now i want to add the features of JQuery I m new to JQuery.I started working with simple hide and show functionality on div . It works fine with simple aspx page but  it does not work with MASTER PAGE when I apply hide and show functionality with toggle('slow'),slideup('slow'),slidedown('fast')  etc effects . I have set the property of div as runat server. Any help appreciated Regards, Chandrakant            

Accessing User Control that is in a Master Page

I have looked everywhere for how to do this and all I come up with is threads describing how to expose public properties.  I have a USER CONTROL in my  Master page. It is a search box with a text box and a dropdown for search type (last name, account number, etc) and a search button.  When the user clicks the search button, I open a new page that displays the results.  How do I pass the values from the USER CONTROL search fields to the new page?  I would post code, but I have nothing to post yet since I don't know where to start. I have tried exposing the public property of the user control, but I don't know how to retrieve those values on the results page.  Anyone have any sample code on how this is done? Thank you in advance for your help!

Accessing a public property of a nested user control in a master page from a pages' user control

Hi  I've got a web site that has a master page and that master page (mpMaster that has a user control (ucControl1) which has a sub user control (ucControl2), this user control has a property which accepts a value. Now, I have a page that uses the master page and on this page I have another user control (ucPageControl), I need to  find a way of setting the value in ucControl2 from ucPageControl. Is this possible at all? Many thanks Ed

Master Page, web service and Ajax autocomplete extender problem.

 I will appreciate very much any help about this issue.  I have been dealing with it for the last week and I couldn't detail and complete examples about this issue. The problem: I have a text box and ajax autocomplete control extender in my Master Page that it is not working at all.  When I type some characters on the text box it doesn't trigger the autocomplete. I have a web service that contains the function code. I est my code on a single Web Page (No Master Page) and it works perfectly.  Also, it works fine if I include the text box and the extender on the Content Page instead of on the Master Page.  It is important to keep the text box in the Master Page for me. I am using Visual Studio 2008 and ASP 3.5.   tHANK YOU VERY MUCH. here is my code:   MASTER PAGE. <%@ Master Language="VB" AutoEventWireup="true" CodeFile="MasterPage.master.vb" Inherits="MasterPage" %> <%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="ajax" %> <%@ Import Namespace = "System.Data" %> <%@ Import Namespace = "System.Data.SQLClient" %> <%@ Import Namespace = "System.Web.Script.Services" %> <%@ Import Namespace="System.Web" %> <%@ Import Namespace="System.Web.Services&

Forms Based Authentication - problem with custom master page and login page



I have successfully enabled and set up FBA (Forms Based Authentication) on my SharePoint 2010 Foundation server. The thing is that I need to customize the look and feel of the login page. I have successfully customized the page (and master page) to look the way I want, however, when I try to log in, I get the following error/message on the page:
"Forms Based Authentication on classic Web applications has been deprecated".

What I've done:
Made copies of /_layouts/simple.master and /_layouts/login.aspx and renamed the copies. The markup in the master page is MUCH simpler than the original, but I've kept all the ContentPlaceholders that I don't use (most of them) in a hidden <asp:Panel at the bottom of the page.

I've changed the web.config file:
<authentication mode="Forms">
      <forms loginUrl="/_layouts/loginCustom.aspx" />

So, I'm not getting any errors on the page until I try to log in. When I use the default settings (login.aspx and simple.master) it works just fine (but damn that page looks ugly!).

Does anyone know what I might be missing?

Update: I believe the reason it doesn't work is because my custom login aspx is not part of the Claims Based Web Application (because it's sitting

referencing a user control in a master page



I have the following code which at the moment sits in a number of pages:

    private void ConfigureEmailSignup()
        ContentPlaceHolder cphBaseContent1 =
        if (cphBaseContent1 != null)
            Controls_Email_Signup emailSignUp =
            if (emailSignUp != null)
                emailSignUp.DisplayType = "store-list";
                // event log
            // event log

It sits in the page because I reference the usercontrol type 'emailSignUp' and pass data to an exposed variable 'DisplayType'.  The control is located in the pages master page. Ideally what i'd like to do is put this in its own class or something, so I can just call it passing the configuration variable, but I'm unsure how this would work - any advice would be appreciated.





what is the use formsAuthentication.user.identity

is it one of the property of page

Custom master page + on explorer minimizing + page should setup like maximized page + problem after



i am created a custom master page in sharepoint 2010 and applied the custom master page to MySite.


on explorer maximization - team site is appearing properly

on explorer minimizing - team site is not appearing(it should appear as explorer maximized site page) - which is not happening

on refreshing the page (on explorer minimizing team site page) - then only it is appearing setting up properly.

pls help me to fix this issue.

problem with User.Identity.Name


 I am getting an error on User that says "The name User does not exist in the current context".

I have downloaded the program Tailspin from www.asp.net

I am following the tutorial and recreating it from scratch. The problem exists in a class that was put into a folder called Classes. Here is the code. (Note in the downloaded program when I hover over the word user the tooltip says - System.Security.Principle.IPrincipal Page.User

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using uboPrducts.Data_Access;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;

namespace uboPrducts.Classes
    public struct ShoppingCartUpdates
        public int ProductId;
        public int PurchaseQantity;
        public bool RemoveItem;

    public partial class MyShoppingCart
        public const string CartId = "TailSpinSpyWorks_CartID";

        public String GetShoppingCartId()
            if ( System.Web.HttpContext.Current.Session[CartId] == null)
                System.Web.HttpContext.Current.Session[CartId] = S

MOSS 2010 Master page problem


Hi Everybody,

     I am facing a strange problem with sharepoint 2010 default.master page. suddenly it is showing as sharepoint 2007 default.master page. How can I get back the sharepoint 2010 default.master page. I tried to create a new team site in sharepoint 2010 and I opened the the site in sharepoint designer 2010 ,that new site default.master also showing with MOSS 2007 default.master page styles. Please Help me... 

Thanks in Advance... :'(




Problem :- using AJAX and GridView in a nested master Page


HI ,

Have been scratching my head regarding

"Control with ID 'GRID1' being registered through RegisterAsyncPostBackControl or RegisterPostBackControl must implement either INamingContainer, IPostBackDataHandler, or IPostBackEventHandler."

-------not using any update panels in masterpages.

-------grid.databind on page load of content page.

any help is really appreciated.

Thank you

Unique content within master page based on conditions met


 Hi all-

I would like to present users with unique content based on certain conditions being met as they land on the home page (default.aspx).  The condition logic will be in the VB code behind Page Load event. The content will go in a content placeholder as specificed from the master page. 

However, the content change wouldn't be something small (ie making a panel or label visible or not) but rather it will be different HTML,  Divs and databound gridview content.  The HTML content will be stored in the database.

Can someone point me in the right direction for best practices on how to accomplish this?


Building Re-Usable ASP.NET User Control and Page Libraries with VS 2008


I am having problems with a user control. I want my solution to have a separate project for holding my user controls.

The main project can get a reference to this user control project and can import this user control dll into my main project. 

Thanks in advance,

Dheeraj Mittal


Passing Linq Statement between master and content page


I usually work with windows forms, and am just starting to work with ASP.Net, so appologies if this is a dumb question!

I have a master page which has a search button on it. The results of this are built up using a Linq statement and if there are any results, I want to display the results in a contents page.

On the masterpage, I have the following code:

Private _res

    Public Overridable ReadOnly Property SearchRes()
            Return _res
        End Get
    End Property

 Private Sub DoSearch()
   'some code to get a linq result

    If res.Any Then
            _res = res
            Server.Transfer("SearchResults.aspx", True)
            'no results
            LabelNoRes.Visible = True
        End If
 End Sub

On the SearchResults.aspx page I have this code.

Dim m As pxSite = CType(Page.Master, MasterPage)
        If m.SearchRes IsNot Nothing Then
            Label1.Text = "Results found = " & m.SearchRes.Count
        End If

m.searchRes is always nothing. 

What am I doing wrong here?


Re-positioning an HTML container with javascript onresize with a Master page.


I have an HTML <div> container that I float to the right of a gridview.  When the browser window is maximized, it looks fine.  When minimized, the gridview positions below the floating container and most of the data is pushed off the bottom of the browser - you have to scroll down to see it.

If I position the floating container above the gridview it looks fine in a minimized window, but looks real bad when maximized.

What I want to do is use a javascript: onresize event to re-position the floating container up or down depending on the window.inner.width AND do it with a Master/Content page structure AND do it for only the one page where needed.

I can capture the onresize event and display the window dimensions but haven't figured-out how to do it with a Content page that still uses the Master page.  I think I'm having a very "thick" week...

- Tinker


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend