Hi,
I'm a
complete Newbee on C# sharp, a real freshman so to speak and I could definitely use some help.
I've Managed to create a very basic website, using Webforms with Visual C#. I'm using Visual Studio 2010 and .NET 3.5.
For this site I created a Master page, on which all my Web Forms will be based. On every webform I want to display the username and the e-mail address of the users who will be accessing my site.
But I don't have any clue whatsoever how to perform a AD query from my Masterpage.master
Beneath is what I created so for.
- So where should I query AD?
- How would the code look like?
- Can I use my Toolbox for this?
- Username should be displayed at USer_Name (see code beneath)
- E-MailAddress should be displayed at E-Mail_adres (see code beneath)
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
<style type="text/css">
.style1
{
width: 100%;
height: 140px;
}
.style4
{
width: 107px;
margin-left: 40px;
}
#form1
{
height: 545px;
}
.style10
{
font-family: "Times New Roman", Times, serif;
color: #3333FF;
font-size: xx-large;
font-weight: 700;
}
.style11
{
width: 30%;
}
.style12
{
width: 18%;
float: left;
}
.style13
{
width: 80%;
float: right;
}
.style14
{
color: #3333FF;
}
.style15
{
width: 0%;
float: left;
height: 291px;
}
.style16
{
color: #000000;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="style1">
<tr>
<td class="style4">
<asp:Image ID="Rabobank" runat="server" Height="125px"
ImageUrl="~/Images/xyz.png" Width="98px" />
</td>
<td class="style10" height="2">
<strong>Any Device Portaal</strong></td>
<td class="style10" height="2">
<asp:ContentPlaceHolder ID="Sub_Titel" runat="server">
</asp:ContentPlaceHolder>
</td>
<td>
<asp:Image ID="Image1" runat="server" Height="126px" ImageAlign="Right"
ImageUrl="~/Images/SmartPhones.jpg" Width="115px" />
</td>
</tr>
</table>
</div>
<asp:Panel ID="Panel1" runat="server" BackColor="#3333FF" BorderColor="#3333FF"
ForeColor="#3333FF" Height="3px">
<hr />
</asp:Panel>
<br />
<table align="right" class="style11">
<tr>
<td>
Gebruikersnaam:</td>
<td>
USer_Name</td>
</tr>
<tr>
<td>
E-Mail adres</td>
<td>
E-Mail_adres</td>
</tr>
</table>
<br />
<br />
<br />
<table align="left" class="style12">
<tr>
<td style="text-decoration: underline; font-weight: 700">
<span class="style14">Handige Links:</span><br />
<asp:HyperLink ID="HyperLink_Main_01" runat="server">ICT_Services</asp:HyperLink>
<br />
<asp:HyperLink ID="HyperLink_Main_02" runat="server">Blog</asp:HyperLink>
<br />
<asp:HyperLink ID="HyperLink_Main_03" runat="server">Manuals</asp:HyperLink>
<br />
<br />
<span class="style14">Navigatie Any Device:<br />
</span>
<asp:HyperLink ID="StartPagina_StartPagina" runat="server" CssClass="style16"
NavigateUrl="~/Default.aspx">Start Pagina</asp:HyperLink>
<br />
<asp:HyperLink ID="StartPagina_Got_Problem" runat="server"
NavigateUrl="~/Got_Problem.aspx" style="color: #000000">Problemen met mijn toestel</asp:HyperLink>
<asp:ContentPlaceHolder ID="HyperLinks" runat="server">
</asp:ContentPlaceHolder>
</td>
</tr>
</table>
<table align="left" class="style15">
<tr>
<td bgcolor="#3333FF">
</td>
</tr>
</table>
<table align="right" class="style13">
<tr>
<td>
<asp:ContentPlaceHolder ID="Main_Title" runat="server">
</asp:ContentPlaceHolder>
<asp:ContentPlaceHolder ID="Main_Body" runat="server">
</asp:ContentPlaceHolder>
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
</form>
<div id="footerContent">
2011 xyz. Alle rechten voorbehouden.
<br />
Any Device is onderdeel van abc</div>
</body>
</html>