Unable to pass a variable from my code behind to the .net page
<p>I am very new to C# and I am getting an issue with a variable that I am not able to call to display on my aspx page.</p>

<p>The code behind is as follow:</p>

<pre><code>using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using System.DirectoryServices;
using System.DirectoryServices.AccountManagement;

namespace PRIIS
{
   public partial class _Default : System.Web.UI.Page
   {
    private DirectoryEntry GetDirectoryObject()
    {
        DirectoryEntry oDE;
        oDE = new DirectoryEntry("LDAP://192.168.5.4", "user", "xxxx", AuthenticationTypes.Secure);
        return oDE;
    }
    public DirectoryEntry GetUser(string UserName)
    {
        DirectoryEntry de = GetDirectoryObject();
        DirectorySearcher deSearch = new DirectorySearcher();
        deSearch.SearchRoot = de;

        deSearch.Filter = "(&amp;(objectClass=user)(SAMAccountName=" + UserName + "))";
        deSearch.SearchScope = SearchScope.Subtree;
        SearchResult results = deSearch.FindOne();

        if (!(results == null))
        {
            de = new DirectoryEntry(results.Path, "user", "xxxx", AuthenticationTypes.Secure);
            return de;
        }
        else
        {
            return null;
        }

    }
    public class MyUserName
    {
        public string strName;
        public string str;

        public void userNameOnSystem()
        {
            strName = HttpContext.Current.User.Identity.Name.ToString();
            string[] splitString = strName.Split('\\');
            str = splitString[1];
        }



    }

    protected void Page_Load(object sender, EventArgs e)
    {

        DirectoryEntry de = GetUser("dramirez");
        if (de != null)
        {

            string displayUser = de.Properties["displayName"].Value.ToString();

            Response.Write(displayUser + "&lt;br/&gt;");
            //Response.Write(de.Properties["telephoneNumber"].Value.ToString() + "&lt;br/&gt;");
            //Response.Write(de.Properties["mail"].Value.ToString() + "&lt;br/&gt;");
            //Response.Write(de.Properties["userPrincipalName"].Value.ToString() + "&lt;br/&gt;");

           } 



       }

   }
</code></pre>

<p>}</p>

<p>And the call that I am doing is to the displayUser string that I want to display on the .aspx page using the following statement</p>

<pre><code>&lt;%= displayUser %&gt;
</code></pre>

<p>unfortunately I am getting the error;</p>

<p>Error 2 The name 'displayUser' does not exist in the current context</p>

<p>And I am not sure how or where the issue is coming from.</p>

<p>Thank you in advance for any help.</p>
