The type or namespace name 'PrincipalContext' could not be found

I am attempting to retrieve a user's full name from AD with the code below in .aspx using C#. I am using Sharepoint Designer 2010. I keep getting the error 'An error occurred during the compilation of the
requested file, or one of its dependencies. The type or namespace name 'PrincipalContext' could not be found (are you missing a using directive or an assembly reference?). What am I doing wrong?
@using System.IO;
@using System.DirectoryServices.AccountManagement;
@using System.DirectoryServices;
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
    string fac1;
    string userid;
    string fname;
    string lname;
    string fullname;
    protected void btnShowInfo_Click(object sender, EventArgs e)
        try
            userid = GetHTTPContext();          
        catch (Exception ex)
            Response.Write(ex.Message + "<BR>" + ex.StackTrace);
        finally
        using (PrincipalContext context = new PrincipalContext(ContextType.Domain));
                WindowsPrincipal principal = (WindowsPrincipal)User;
                UserPrincipal user = UserPrincipal.FindByIdentity(context, principal.Identity.Name);
                fname = user.GivenName;
                lname = user.Surname;
                fullname = user.Name;
                Response.Write(fname + "  " + lname)
    private string GetHTTPContext()
        return(HttpContext.Current.User.Identity.Name);

I was able to fix the error by importing the namespaces and including the assemblies. That got me past the 'PrincipalContext' error.
Now I am getting an error on the line 'UserPrincipal user =...':
An error occurred during the
compilation of the requested file, or one of its dependencies. The name
'context1' does not exist in the current context
Here is the code:
            using( PrincipalContext context1 = new PrincipalContext(ContextType.Domain)); 
                WindowsPrincipal principal = (WindowsPrincipal)User;
                UserPrincipal user = UserPrincipal.FindByIdentity(context1, principal.Identity.Name);

Similar Messages

  • The type or namespace name 'SPSite' could not be found (are you missing a using directive or an assembly reference?)_

    I am creating a Winforms application. I need to upload and download a file from Sharepoint.
     I have added reference to Microsoft.Sharepoint.Client.
    Below is the code to upload file:
    using System.IO;
    using Microsoft.SharePoint;
    private void Button_Click_1(object sender, RoutedEventArgs e)
                String fileToUpload = @"C:\Test.txt";
                String sharePointSite = "https://myshapoint";
                String documentLibraryName = "Test";
                using (SPSite oSite = new SPSite(sharePointSite))
                    using (SPWeb oWeb = oSite.OpenWeb())
                        if (!System.IO.File.Exists(fileToUpload))
                            throw new FileNotFoundException("File not found.", fileToUpload);
                        SPFolder myLibrary = oWeb.Folders[documentLibraryName];
                        // Prepare to upload
                        Boolean replaceExistingFiles = true;
                        String fileName = System.IO.Path.GetFileName(fileToUpload);
                        FileStream fileStream = File.OpenRead(fileToUpload);
                        // Upload document
                        SPFile spfile = myLibrary.Files.Add(fileName, fileStream, replaceExistingFiles);
                        // Commit 
                        myLibrary.Update();
    But i get the error "The type or namespace name 'SPSite' could not be found (are you missing a using directive or an assembly reference?)"
    I am not sure what else I am supposed to do here.

    Hi,
    If you want to develop a WinForm application to be only used in SharePoint Server, we can use Server-Side Object Model(use Microsoft.Sharepoint.dll) to achieve it. 
    If you want to use the WinForm application to be used both in Server side and Client Side, I suggest you use .Net Client Object Model(use Microsoft.Sharepoint.Client.dll) to achieve it.
    Here are two links for your reference:
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/c357e3c7-37e9-4ded-83aa-a57beae0b0e4/how-to-upload-download-files-to-sharepoint-2013?forum=sharepointdevelopment
    http://msdn.microsoft.com/en-us/library/ff798388.aspx
    Best Regards
    Dennis Guo
    TechNet Community Support

  • The type or namespace name 'SQLite' could not be found (are you missing a using directive or an assembly reference?)

    Trying to get sql server compact up and running. I connected to a sqlite database and atuo generated the model.cs code.
    however, I get the following error.
    Error    1    The type or namespace name 'SQLite' could not be found (are you missing a using directive or an assembly reference?)    C:\Users\kenny\Documents\Visual Studio 2013\Projects\WindowsFormsApplication2\WindowsFormsApplication1\Model.cs  
     3
    Any help is greatly appreciated. Please provide some detail as I am novice. 
    Thanks

    Ok so I got the past that problem. I had to add the package System.Data.SQLite Core in Manage NuGet.
    Then I changed the auto-generated code "using SQLite" to "using System.Data.SQLite".
    But now I have a new problem, it says "System.Data.SQLite.SQLiteConnection' does not contain a definition for 'CreateTable' "
    Here is the code
    //This code was generated by a tool.
    //Changes to this file will be lost if the code is regenerated.
    //using SQLite;
    using System;
    using System.Data.SQLite;
    using System.Data.SQLite.EF6;
    namespace WindowsFormsApplication2
    public class SQLiteDb
    string _path;
    public SQLiteDb(string path)
    _path = path;
    public void Create()
    using (SQLiteConnection db = new SQLiteConnection(_path))
    db.CreateTable<servers>();
    public partial class servers
    public Int64 server_name { get; set; }
    public Double cpu_usage { get; set; }
    Any ideas why CreateTable is not available?

  • The type or namespace name 'IBM' could not be found (are you missing a using directive or an assembly reference?)

    please help on below error 
    Compilation Error
    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
    Compiler Error Message: CS0246: The type or namespace name 'IBM' could not be found (are you missing a using directive or an assembly reference?)
    Source Error:
    Line 27: using System.Web.Services;
    Line 28: using System.Net;
    Line 29: using IBM.WMQ;
    Line 30: using System.DirectoryServices.AccountManagement;
    Source File: c:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\NBO\LogComplaint.aspx.cs   
    Line: 29

    Hello,
    >>using IBM.WMQ
    It seems you are using third party dll namespace reference in your project but that dll is not being added in project. Please get the IBM.WMQ dll and add it first in your current visual studio project by right click on project-->add reference.
    You can place this dll in GAC or can directly add to project as suggested by jaydeep.
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • The type or namespace name 'Skeleton' could not be found in V2.0 kinect

    I Have Use kinect 2.0V and install and add toolkit and Use this Code.
    then display error in "Skeleton" Class but same code already working 1.8V.
    public interface ICommonProperty
            Skeleton currentSkeleton
                get;
                set;

    Hi Achal,
    the Skeleton class in v1.8 was replaced with the Body class in v2.0. Just have a look at the Body example in the SDK Browser to see hot to use it.
    There is also a tutorial of all sources introduced in v2.0 on Channel9:
    http://channel9.msdn.com/Series/Programming-Kinect-for-Windows-v2/02
    Greets!

  • The type or namespace name 'Optimization' does not exist in the namespace 'System.Web'

    App_Start\BundleConfig.cs (1): The type or namespace name 'Optimization' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
     Global.asax.cs (4): The type or namespace name 'Optimization' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
     App_Start\BundleConfig.cs (8): The type or namespace name 'BundleCollection' could not be found (are you missing a using directive or an assembly reference?)
    I'm getting the above errors when attempting to create a remote build.
    I've tried the solution found here (http://blog.davidebbo.com/2014/01/the-right-way-to-restore-nuget-packages.html) but no luck.

    Hi,
    I have an asp.net mvc project in Visual Studio 2013. I'm hosting it on Visual Studio Online. 
    The project builds fine on my local machine/Visual Studio 2013. When i try to do a build on Visual Studio Online (i created a build definition there), i get similar errors. 
     App_Start\BundleConfig.cs (2): The type or namespace name 'Optimization' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
     App_Start\FilterConfig.cs (2): The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
     App_Start\RouteConfig.cs (5): The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
     Controllers\HomeController.cs (5): The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
     Controllers\HomeController.cs (9): The type or namespace name 'Controller' could not be found (are you missing a using directive or an assembly reference?)
     Global.asax.cs (5): The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
     Global.asax.cs (6): The type or namespace name 'Optimization' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
     App_Start\BundleConfig.cs (9): The type or namespace name 'BundleCollection' could not be found (are you missing a using directive or an assembly reference?)
     App_Start\FilterConfig.cs (8): The type or namespace name 'GlobalFilterCollection' could not be found (are you missing a using directive or an assembly reference?)
     Controllers\HomeController.cs (11): The type or namespace name 'ActionResult' could not be found (are you missing a using directive or an assembly reference?)
     Controllers\HomeController.cs (16): The type or namespace name 'ActionResult' could not be found (are you missing a using directive or an assembly reference?)
     Controllers\HomeController.cs (23): The type or namespace name 'ActionResult' could not be found (are you missing a using directive or an assembly reference?)
     C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Common.CurrentVersion.targets (1697): Could not resolve this reference. Could not locate the assembly "System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35,
    processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
     C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Common.CurrentVersion.targets (1697): Could not resolve this reference. Could not locate the assembly "System.Web.Optimization". Check to make sure the assembly exists on disk. If this
    reference is required by your code, you may get compilation errors.
     C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Common.CurrentVersion.targets (1697): Could not resolve this reference. Could not locate the assembly "System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL".
    Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
     C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Common.CurrentVersion.targets (1697): Could not resolve this reference. Could not locate the assembly "System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35,
    processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
     C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Common.CurrentVersion.targets (1697): Could not resolve this reference. Could not locate the assembly "System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35,
    processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
     C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Common.CurrentVersion.targets (1697): Could not resolve this reference. Could not locate the assembly "System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35,
    processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
     C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Common.CurrentVersion.targets (1697): Could not resolve this reference. Could not locate the assembly "WebGrease". Check to make sure the assembly exists on disk. If this reference is required
    by your code, you may get compilation errors.
     C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Common.CurrentVersion.targets (1697): Could not resolve this reference. Could not locate the assembly "Antlr3.Runtime". Check to make sure the assembly exists on disk. If this reference
    is required by your code, you may get compilation errors.
     C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Common.CurrentVersion.targets (1697): Could not resolve this reference. Could not locate the assembly "Newtonsoft.Json". Check to make sure the assembly exists on disk. If this reference
    is required by your code, you may get compilation errors.
     C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Common.CurrentVersion.targets (1697): Assembly strong name "System.Web.Mvc, Version=__MvcPagesVersion__, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" is
    either a path which could not be found or it is a full assembly name which is badly formed. If it is a full assembly name it may contain characters that need to be escaped with backslash(\). Those characters are Equals(=), Comma(,), Quote("), Apostrophe('),
    Backslash(\).

  • The type or namespace name 'VisualStudio' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

    we are using VS 2013. i have created new build definition and run that created build its getting failed and showing error message as "The type or namespace name 'VisualStudio' does not exist in the namespace 'Microsoft' (are you missing an assembly
    reference?)" and "The type or namespace name 'WinComboBox, UITestControl, WinTitleBar.....etc' could not be found (are you missing a using directive or an assembly reference?)". in the error log is showing the error number are "error CS0234
    & error CS0246". 
    Actually i have created build for automation execution from MTM lab environment. i have to assign the build to the test plan. once the build is passed , i will assign to the test plan and run with automation options. 
    if i build the solution its getting successfully build. but when i run the created build definition it show the error message's.  
    Could you guide me how to resolve the above error's ? 
    Thanks in Advance...

    Hello Divakar Ponnada,
    I have checked the error CS0234 from here:
    http://msdn.microsoft.com/en-us/library/0e92xd7b.aspx
    It means your project cannot find the proper reference to your type "Visual Studio" from the namespace Microsoft.
    May I ask this question, does your build definition means something like the following blog described?
    http://www.asp.net/web-forms/overview/deployment/configuring-team-foundation-server-for-web-deployment/creating-a-build-definition-that-supports-deployment
    "A build definition is the mechanism that controls how and when builds occur for team projects in TFS. "
    If that is the problem, may I ask whether your build agent is in the same machine where you build your application?
    The build agent will first search for the reference from its local GAC and if it cannot find it, the error like you said will reports. Please manually build your project from your build agent machine to see the result, or install Visual Studio to your build
    agent machine. In that way I think your problem may fixed.
    Best regards,
    Barry
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Error on new windows 8.1 project: The type or namespace name 'Foundation' does not exist in the namespace

    I upgraded to win 8.1 and VS 2013. I created a new Windows 8.1 C# grid  project and tried to compile it and I'm seeing the  following error: Error 1 The type or namespace name 'Foundation' does not exist in the namespace [my namespace](are
    you missing an assembly reference?)
    The errors are in navigationhelper.cs line 59  
    [Windows.Foundation.Metadata.WebHostHidden] // Foundation has the squigglies
    public class NavigationHelper : DependencyObject
    and app.xaml.cs line 68 ==> rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0]; which causes this error: Error 2 The type or namespace name 'Globalization' does not exist in the namespace [my namespace] (are you missing
    an assembly reference?)
    Windows phone and mvc projects are working fine and I've installed all the updates and even tried to fix vs 2013.
    Any help Is greatly appreciated.

    I did some more investigation and noticed that if I create an app with a "." in the name then this problem occurs. For example create a windows store project with the default name "App1": this will compile.
    However if I name the project "App1.Forms" to correspeond with the default namespace I want, then this problem occurs.  Still investigating but anyone should be able to repro it with that step.

  • The type or namespace name 'BusinessData' does not exist in the namespace 'Microsoft.SharePoint' (are you missing an assembly reference?)

    I am trying to compile my SharePoint 2010 solution(VS2010) in VS2013 to deploy in SP2013, i have removed all old 14 ref and added 15 ref for microsoft.SharePoint, office.server and other assemblies. 
    still i am getting "The type or namespace name 'BusinessData' does not exist in the namespace 'Microsoft.SharePoint'
    (are you missing an assembly reference?)"
    did i miss any step here or any version issue?
    any suggestions to resolve
    Thanks
    S.Venkata Appaji

    Hi,
        Just confirm that Target Frame work has been changed to 4.5 or not, if not changed it to 4.5 and give it a try.  Then also it gives error then check the SP reference, dll properties and check its version(it should be 15.0.).
    PS:-You can fine target framework under project properties->Application-> Target Framework.
    Regards,
    MS

  • Experiencing "The type or namespace name 'DirectoryServices' does not exist in the namespace 'System' (are you missing an assembly reference?)" compilation error

    I am just starting to implement a new user login authentication process wherein after prompting user for username & password, I hope to authenticate them againts our company Active Directory user data. Since I am just starting, I only have very few things
    done at this point which is how I wanted to work on this so that my development environment is still at its simplest state.
    I am using the following for development:
    MS-Visual Studios Professional 2013 Version 12.0.30501.00 Update 2, and
    MS .NET Framework Version 4.5.50938.
    Here are my project solution's current items:
    Web.config:
    <?xml version="1.0"?>
    <!--
    For more information on how to configure your ASP.NET application, please visit
    http://go.microsoft.com/fwlink/?LinkId=169433
    -->
    <configuration>
    <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
    </system.web>
    <system.webServer>
    <defaultDocument enabled="true">
    <files>
    <add value="Login.aspx" />
    </files>
    </defaultDocument>
    </system.webServer>
    </configuration>
    Web.Debug.config:
    <?xml version="1.0" encoding="utf-8"?>
    <!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
    <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
    <!--
    In the example below, the "SetAttributes" transform will change the value of
    "connectionString" to use "ReleaseSQLServer" only when the "Match" locator
    finds an attribute "name" that has a value of "MyDB".
    <connectionStrings>
    <add name="MyDB"
    connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
    xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
    </connectionStrings>
    -->
    <system.web>
    <compilation xdt:Transform="RemoveAttributes(debug)" />
    <!--
    In the example below, the "Replace" transform will replace the entire
    <customErrors> section of your web.config file.
    Note that because there is only one customErrors section under the
    <system.web> node, there is no need to use the "xdt:Locator" attribute.
    <customErrors defaultRedirect="GenericError.htm"
    mode="RemoteOnly" xdt:Transform="Replace">
    <error statusCode="500" redirect="InternalError.htm"/>
    </customErrors>
    -->
    </system.web>
    </configuration>
    Web.Assemblies.config:
    <?xml version="1.0"?>
    <configuration>
    <system.web>
    <compilation debug="false" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
    <assemblies>
    <add assembly="System.DirectoryServices, Version=4.0.0.0, Culture=neutral PublicKeyToken=b03f5f7f11d50a3a"/>
    </assemblies>
    </system.web>
    </configuration>
    Login.aspx:
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Login" %>
    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title></title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div id="loginForm" style="height: 562px; width: 399px; margin-left: 0px" title="Login Form">
    &nbsp;&nbsp;&nbsp;&nbsp;
    <asp:Label ID="loginPageLabel" runat="server" Font-Bold="True" Font-Names="Arial Black" Font-Size="Large" Text="Please Log In"></asp:Label>
    <br />
    <br />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:Label ID="loginUsernameLabel" runat="server" Text="Username:"></asp:Label>
    &nbsp;&nbsp;&nbsp;
    <asp:TextBox ID="loginUserNameTextBox" runat="server" OnTextChanged="loginUserNameTextBox_TextChanged" Width="213px" Wrap="False" AutoPostBack="True" TabIndex="1"></asp:TextBox>
    <br />
    <br />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:Label ID="loginPasswordLabel" runat="server" Text="Password:"></asp:Label>
    &nbsp;&nbsp;&nbsp;
    <asp:TextBox ID="loginPasswordTextBox" runat="server" OnTextChanged="loginPasswordTextBox_TextChanged" Width="212px" Wrap="False" AutoPostBack="True" TabIndex="2"></asp:TextBox>
    <br />
    <br />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:RadioButton ID="loginUAradioButton" runat="server" Font-Bold="True" OnCheckedChanged="loginUAradioButton_CheckedChanged" Text="TUPSS Associate" AutoPostBack="True" TabIndex="3" />
    &nbsp;&nbsp;
    <asp:RadioButton ID="loginAFradioButton" runat="server" Font-Bold="True" OnCheckedChanged="loginAFradioButton_CheckedChanged" Text="Area Franchisee" AutoPostBack="True" TabIndex="4" />
    <br />
    <br />
    <br />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:Button ID="loginSubmitButton" runat="server" Font-Bold="True" OnClick="loginSubmitButton_Click" Text="Log In" TabIndex="5" />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:Button ID="loginCancelButton" runat="server" Font-Bold="True" OnClick="loginCancelButton_Click" Text="Cancel" TabIndex="6" />
    <br />
    <br />
    &nbsp;&nbsp;
    <asp:Label ID="loginStatusInstructionLabel" runat="server" Text="Status/Instruction:"></asp:Label>
    <br />
    &nbsp;&nbsp;
    <asp:TextBox ID="loginStatusInstructionTextBox" runat="server" Height="230px" MaxLength="100" Rows="12" TextMode="MultiLine" Width="360px" EnableViewState="False" OnTextChanged="loginStatusInstructionTextBox_TextChanged" ReadOnly="True" TabIndex="-1"></asp:TextBox>
    </div>
    </form>
    </body>
    </html>
    Login.aspx.cs:
    using System;
    using System.DirectoryServices;
    public partial class Login : System.Web.UI.Page
    private string uName; // user-entered username
    private string pWord; // user-entered password
    private int loginLoadCycles; // just keeping track of how many times Page_Load is called
    protected void Page_Load(object sender, EventArgs e)
    if (this.loginUserNameTextBox.Text == String.Empty &&
    this.loginPasswordTextBox.Text == String.Empty &&
    this.loginUAradioButton.Checked == false &&
    this.loginAFradioButton.Checked == false)
    this.loginInit();
    this.setLoginVisibilityAndFocus();
    this.loginLoadCycles += 1;
    private void loginInit()
    this.uName = String.Empty;
    this.pWord = String.Empty;
    this.loginLoadCycles = 0;
    private void setLoginVisibilityAndFocus()
    // Decide on whether or not the Login submit & cancel buttons should be enabled or not
    if ( this.loginUserNameTextBox.Text == String.Empty ||
    (this.loginUAradioButton.Checked == false && this.loginAFradioButton.Checked == false) )
    this.loginSubmitButton.Enabled = false;
    this.loginCancelButton.Enabled = false;
    this.loginStatusInstructionTextBox.Text = "Please specify if you are a TUPSS Associate or an Area Franchisee by checking either the 'TUPSS Associate' or 'Area Franchisee' checkbox.";
    else
    this.loginSubmitButton.Enabled = true;
    this.loginCancelButton.Enabled = true;
    if (this.loginPasswordTextBox.Text == String.Empty)
    this.loginStatusInstructionTextBox.Text = "Now that you have entered your username & type, please enter your password.";
    else
    this.loginStatusInstructionTextBox.Text = "When you are ready, please select either the Log In button to login, or the Cancel button to abort.";
    if (this.loginUAradioButton.Checked == false && this.loginAFradioButton.Checked == false)
    this.SetFocus(this.loginUAradioButton);
    else if (this.loginUserNameTextBox.Text == String.Empty)
    this.SetFocus(this.loginUserNameTextBox);
    else if (this.loginPasswordTextBox.Text == String.Empty)
    this.SetFocus(this.loginPasswordTextBox);
    else
    this.SetFocus(this.loginSubmitButton);
    protected void loginUserNameTextBox_TextChanged(object sender, EventArgs e)
    protected void loginPasswordTextBox_TextChanged(object sender, EventArgs e)
    // For some reason, after specifying that the password entry box's textmode to 'Password' setting,
    // the UI's password textbox is emptied
    this.loginStatusInstructionTextBox.Text = "NOTICE:\nThis application is still under development.\n\n" +
    "This is why the password you entered is visible. Once this portion of the application is ready, it will be masked.\n\n" +
    "Also, still need to figure out why when changing this to Password entry mode to mask its entered data, password is getting reset.";
    protected void loginSubmitButton_Click(object sender, EventArgs e)
    this.loginLoadCycles = 0;
    this.uName = this.loginUserNameTextBox.Text;
    this.pWord = this.loginPasswordTextBox.Text;
    if (this.loginUAradioButton.Checked == true && this.loginAFradioButton.Checked == false)
    this.loginLADPauthenticate('U'); // authenticate UPS Associates against UPS Corp's Active Directory
    else if (this.loginUAradioButton.Checked == false && this.loginAFradioButton.Checked == true)
    this.loginLADPauthenticate('A'); // authenticate Area Franchisees against UPS Store's iNet Active Directory
    else
    // set colors to show that this is an error instead of a status message or instruction
    this.loginStatusInstructionTextBox.Text = "ERROR: Cannot log in without specifying if you are an UPS Associate or an Area Franchisee!";
    protected void loginCancelButton_Click(object sender, EventArgs e)
    this.loginStatusInstructionTextBox.Text = "You have selected to cancel from logging in...";
    // Still need to plan what to do when user cancels out of logging in. For now, just initialize class attributes
    this.loginInit();
    protected void loginUAradioButton_CheckedChanged(object sender, EventArgs e)
    String msg = String.Empty;
    if (this.loginUAradioButton.Checked == true)
    this.loginAFradioButton.Checked = false;
    msg = "Thanks for specifying that you are a TUPSS Associate. ";
    if (this.loginUserNameTextBox.Text == String.Empty)
    msg += "Now please specify your username.";
    else if (this.loginPasswordTextBox.Text == String.Empty)
    msg += "Now please enter your password.";
    this.loginStatusInstructionTextBox.Text = msg;
    protected void loginAFradioButton_CheckedChanged(object sender, EventArgs e)
    String msg = String.Empty;
    if (this.loginAFradioButton.Checked == true)
    this.loginUAradioButton.Checked = false;
    msg = "Thanks for specifying that you are an Area Franchisee. ";
    if (this.loginUserNameTextBox.Text == String.Empty)
    msg += "Now please specify your username.";
    else if (this.loginPasswordTextBox.Text == String.Empty)
    msg += "Now please enter your password.";
    this.loginStatusInstructionTextBox.Text = msg;
    private void loginLADPauthenticate(char whichActiveDirectory)
    String msg = "Authenticating user '" + this.uName + "' with password '" + this.pWord + "' against ";
    if (whichActiveDirectory == 'U')
    msg += "UPS Corp's Active Directory...";
    else if (whichActiveDirectory == 'A')
    msg += "The UPS Store's Franchisee Active Directory...";
    msg += "\n\nNOTICE:\nThis is still under development.\n\nAt this point, this application is supposed to do something else now but is not yet ready.";
    this.loginStatusInstructionTextBox.Text = msg;
    this.loginStatusInstructionTextBox.AutoPostBack = true;
    // Authenticate using LDAP
    protected void loginStatusInstructionTextBox_TextChanged(object sender, EventArgs e)
    I confirmed that I have System.DirectoryServices.dll located in
    C:\Windows\Microsoft.NET\assembly\GAC_MSIL\v4.0_4.0.0.0__b03f5f7f11d50a3a\ folder and that I as well as System have read as well as read&execute privileges
    not only to all folders in its path but also to the DLL file itself.
    I would appreciate any help in trying to resolve this compilation error so that I can proceed with implementing LDAP features for this endeavor.
    Thanks so much,
    hguico @ The UPS Store

    Hi,
    For web application problem, please post your thread in
    ASP.NET forum.
    Best Wishes!
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and
    makes it easier for other visitors to find the resolution later.

  • The type or namespace name 'Workflow' does not exist in the namespace 'Microsoft.Office' (are you missing an assembly reference

    Hi Folks,
    I created SharePoint reusable deigner work flow  which has just 2 state approval process.
    I generated the wsp file with save template option and I successfully imported it into visual studio 2010 I just removed List from the tag and put my custom content type id
    <Association Categories>List<Association Categories>
    when I build the solution I got erro which mention in the title.
    Thanks in advance.....

    Hi Shivaprasad,
    Check .net version in your project properties, If it isset to .net 2.0, change it to .net version to 3.0 and it should work.
     Let me know if it works or not..
    Nilesh

  • The type or namespace name 'Reporting' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

    I have a Windows app that was built some 7 years ago on a WinXP machine using VS2005.  It uses Crystal Reports for the reporting.  We recently got new machines with Win7 x64 and I installed VS 2013 Pro. I moved the app to my machine and upgraded
    it to that VS version.  It previously had a .NET Framework target of version 2.0.  I changed the target to version 4.5.
    I want to use the MS Reporting instead of Crystal Reports.  However, I cannot get the ReportViewer control to show up in the Toolbox.
    I downloaded and installed the ReportViewer Runtime 2012.  I installed the ReportViewer using the NuGen GUI and console.  I tried adding the control to the Toolbox using Tools > Choose Toolbox Items... but it never shows up after I browse to
    the Microsoft.ReportViewer.WinForms.dll file and select it.  I manually typed 'Microsoft.Reporting.WinForms.ReportViewer' and the intellisense came up fine.  But when I build the project I get the error shown in this post's title.
    I'm at a complete loss.  I've searched all over and tried everything I can find on the subject with no luck.
    Can anybody help?
    Thanks.

    Thank you for taking the time.
    The Report Viewer will not appear on the Toolbox, even with references to that assembly.  However the Crystal Reports viewer IS in the Toolbox.
    I think it may be because Crystal Reports is installed and integrated?  I don't know.  I just can't get it to work.
    Thanks again.
    Hello,
    From
    ReportViewer Controls (Visual Studio), we could get that ReportViewer Controls are included in VS2013, that means we don't need to install that control manually.
    To confirm whether this issue is related to your Visual Studio or Crystal Reports, I would recommend you consider testing it with the following ways.
    1. Create a simple windows form application, and open a form designer window, and check whether reportviewer is inside the tool box.
    If it is available, then we could focus on your project to narrow down this issue.
    If it is still missing, we could test it with #2.
    2. Uninstall Crystal Reports and disable all add-ins of VS2013, and if possible, you could also uninstall and reinstall VS2013 to make sure the environment is clean enough. Next repeat the steps of #1.
    It will be much helpful if you could share the detailed results with us.
    Regards,
    Carl
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • The type or namespace name 'Microsoft' does not exist in the namespace 'System'

    I got the reference error while building the code.
    I have added the system and microsoft.sharepoint reference error. But still showing the same error.
    Need help!

    Hi
    According to the error message, please check that whether the target version of the .NET Framework of your application has been changed.
    Please do as follows:
    1. Make sure your project is target on .NET 3.5 .
    2. Add 
    the namespace in your code.(using Microsoft.Office.InfoPath)
    More information about
    Troubleshooting .NET Framework Targeting Errors:
    http://msdn.microsoft.com/en-us/library/vstudio/cc668079(v=vs.100).aspx
    A sample about
    Creating a Basic Form Template with Code for your reference:
    http://msdn.microsoft.com/en-us/library/aa942693(v=office.14).aspx
    Feel free to reply with the test result if the issue still exists.
    Best regards
    Patrick Liang
    TechNet Community Support

  • The type or namespace name 'SharePoint' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)_

    Hi,
    am trying to use simple client object model using console application  and have Included the required assembly 
    microsoft.sharepoint.client
    microsoft.sharepoint.client.runtime
    and added using directive microsoft.sharepoint.client
    then also am getting the error plese help me
    thanx in advance

    Hi,
    From the properties of the project solution, change the platform target to x64, and the target framework to .NET Framework 3.5.
    Let me know if you have any doubt.

  • The type or namespace name 'Microsoft.SqlServer.DacServices' could not be found (are you missing a using directive or an assembly reference

    Microsoft.SqlServer.DacServices dll is referenced in a unit test project and the compiler is showing an error - The type or namespace name 'DacServices' could not be found. 
    Although I referenced the dll file in the project visual studio is still errors out as a missing library. I have also tried downloading the file which has the library from http://www.microsoft.com/en-us/download/details.aspx?id=40735
    by installing Microsoft Data-Tier Application Framework for SQl Server.
    Please shade light on this.
    Thanks,
    Manny

    Hi Manny_R,
    According to your description and error message, before you installing Data-Teir Application Framework components, we need to verify if you choose the right version of Data-Tier Application Framework. For more information, see:
    http://alexw.co.uk/2013/05/cannot-find-dac-assembly-microsoft-sqlserver-dac-dll/
    In addition, Microsoft SQL Server  Data-Tier Application Framework requires Microsoft SQL Server System CLR Types, and Microsoft SQL Server Transact-SQL ScriptDom (SQLSysCLRTypes.msi and SQLDOM.msi). You need to install both SQLSysCLRTypes.msi
    and SQLDOM.msi.
    There is a detail about data-tier application (DAC) features in SQL Server 2012, you can review it.
    http://msdn.microsoft.com/en-us/library/cc879339(v=sql.110).aspx
    Regards,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

Maybe you are looking for

  • Can you hook up a hp 27 recline to a xbox 360?

    I want to buy a xbox 360 and use my hp 27 recline all in one computer to hook it up to just don't know if it can be done has anyone done this?? RAR This question was solved. View Solution.

  • [SOLVED] Using Apple's UEFI boot menu with Arch

    Hello,       I've successfully installed arch on my mid-2012 (5,1) 11" Macbook Air, and now I'm trying to get an entry in apple's boot menu (the one that shows when you hold 'option' when starting the computer).  From the author of rEFInd's install i

  • Very Annoying Problem Installing i-Tunes Ver 8.02

    This rambles... But bear with me... So I moved from London to some small village in the middle of nowhere. I had broadband before moving and when I got here I found that I COULD NOT GET IT HERE ONLY DIAL-UP. Now I know that some of you are rolling yo

  • What are Tabs in the Bookmark Column?

    Can't figure out what 'tabs' are in the bookmark drop down in Safari - looks like I added a web page to whatever tabs are by mistake and now I can't delete it. I'm a recent convert from windoze so please be gentle with me!

  • Extremely slow performance transferring data over USB with Time Capsule

    I have the 2TB wireless Time Capsule. I have it setup as an extension to my current WiFi at home, since I already had a WLAN router. I have an external harddrive (500gig) that I connected to my Time Capsule because I wanted to transfer data from the