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


Post New Web Links

Accessing AD Properties from ASPX (VB.Net)

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :Windows Application
 

Hi,

I need to get the current user's e-mail address from their AD record. I've found plenty of examples by searching but they don;t work for me. When I ask for the value of the property "mail" or "email" (the examples are divided), I'm told there is no such property. The code I used is as follows:

        Dim objDirectoryEntry As DirectoryEntry = New DirectoryEntry("WinNT://" + Request.ServerVariables("LOGON_USER").Replace("\", "/"))
        Dim strDisplayName As String

        strDisplayName = objDirectoryEntry.Properties("fullName").Value.ToString()
       Session("user_email") = objDirectoryEntry.Properties("mail").Value.ToString()

The "fullname" property is retrieved successfully but the mail/email property is not found. Looking at the user properties in adsiedit, I can see there is an (apparently) available property called "mail", however I have also noticed that while there are dozens of properties available per user via adasiedit, only 25 are available via the DirectoryEntry object; Using the following code:

 

Imports System.DirectoryServices

Public Class WebForm4
    Inherits System.Web.UI.Page

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

        Dim objDirectoryEntry As DirectoryEntry = New DirectoryEntry("WinNT://" + Requ


View Complete Post


More Related Resource Links

User Control not accessing the value of the properties send to it from the aspx page.

  

I have a dynamic accordion on a page. Set its datasource to an object of paged data source.The user control is in the accordions content template. When i was writing code the properties were showing but after giving the values of databases as

<ContentTemplate>

<uc:UserControl1  runat="server" Property1='<%#DataBinder.Eval(Container.DataItem,"columname1")%>' Property2='<%#DataBinder.Eval(Container.DataItem,"columname2")%>'  ></uc:UserControl1>

</ContentTemplate>

but the values shows null, these properties are shown as textboxes text property by user control.

MoreOver when I checked the values of database Items.So i made a textbox instead of usercontrol here as

<asp:TextBox ID="txtTest" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"Columname1")%>'></asp:TextBox>

It is showing the correct value. And if i pass the value directly it is also showing correctly like

<uc:UserControl1  runat="server" Property1="XYZ")%>' Property2="ABC")%>'  ></uc:UserControl1>

. where I am wrong


the problem is eval is not passing the value to usercont

System.Messaging - Error accessing properties of remote private queues - "UnsupportedFormatNameExcep

  
I'm having some difficulty accessing private queues on a remote machine, but no trouble using remote public queues or private queues on a local machine. Calling: System.Messaging.MessageQueue.GetPrivateQueuesByMachine("machine"); ..succesfully returns the array of private queues on the remote machine.  However, trying to access nearly all of the properties on these MessageQueue objects returns: MessageQueueErrorCode: UnsupportedFormatNameOperation Message:"The specified format name does not support the requested operation. For example, a direct queue format name cannot be deleted." I have no trouble accessing queues created identically on the local machine using GetPrivateQueuesByMachine("."), plus accessing public queues using GetPublicQueuesByMachine("machine") also returns MessageQueue objects that are useable. The FormatName returned appears to be valid, as you would expect from queues retreived via GetPrivateQueuesByMachine().  e.g: FormatName:Direct=OS:machine\\private$\\example ..so I think the error message returned may be somewhat spurious. The permissions on the queues all appear to be set correctly.  I had even attempted allowing "Full Control" to "Everyone" on these queues as an experiment, with the same results. Any ideas for other things I might try? p.s. I am running Windows XP SP2, using .NET 2.

modify/override properties of default sharepoint modal dialogs (ex. editview.aspx) using javascript

  
Hello all, I would like to know how can I modify (override) some properties of the default sharepoint modal dialogs using Javascript. Ex. the size and location of editview.aspx. I while ago I asked a question about overriding the DialogResult in the display view dialog. I got an answer from Zach which looked like this:             sb.Append("<script type=\"text/javascript\">");             sb.Append(@"window.setTimeout(function () {");             sb.Append(@"if (window.frameElement && typeof(window.frameElement.overrideDialogResult) == 'function')");             sb.Append(@"{");             sb.Append(@"SP.SOD.executeFunc('sp.ui.dialog.js', 'SP.UI.DialogResult.OK', function () {");             sb.Append(@"window.frameElement.overrideDialogResult(SP.UI.DialogResult.OK); ");             sb.Append(@"});");             sb.Append(@"}");  

Accessing ASPX page elements from ASCX'S jquery function

  

Hi Friends, I need your help.

I have aspx page and in that page i registerd ascx page. i want to access the aspx page <div id = "idofdiv"> from ascx page jquery function. i have jquery function in ascx page. i want to access idofdiv in that function. how could i achive this?

Thanks

Ram 


Accessing SelectedItem of DropDownList in WebPart Custom Properties

  

Hey,

I've made a simple Visual Web Part using an AJAX timer to count down to dates.

I have added a custom property which is a list of events, but I cannot find the Selected Item value in my ascx.cs file.

Here is how the property is set:

 

using

 System;
using

 System.ComponentModel;
using

 System.Web;
using

 System.Web.UI;
using

 System.Web.UI.WebControls;
using

 System.Web.UI.WebControls.WebParts;
using

 Microsoft.SharePoint;
using

 Microsoft.SharePoint.WebControls;

namespace

 CountdownVWP.VisualWebPart1
{
 [ToolboxItemAttribute(true

)]
 public

 class

 VisualWebPart1 : WebPart
 {
 public

 enum

 EventList
 {
  Christmas,
  Easter,
  Halloween
 };

 protected

 EventList myEventList;

 [WebBrowsable(true

), Category("Configuration&quo

Accessing my custom aspx page in the place of Newform.aspx of the list

  

Hi,

I have a aspx page where i have designed the controls as per the need.Now my requirement is as soon as user click on 'New' of the List,i am expecting to aspx page to come as Newform.aspx of the list.Could you please share your ideas regarding this?

Thanks & Regards,

Sudheer


Accessing 'Window Control Library' .dll from a .aspx page on webserver

  


I have a control in a 'window control library' which handles - 'drag and drop' files from computer to a listbox control, I then reference this .dll in .aspx (See code below). Now, when i try to access this through webserver for drag and drop files i get following errror - The type of the first permission  that failed was : System.Security.Permission.FileIOPermission.

I have a control in a 'window control library' which handles - 'drag and drop' files from computer to a listbox control, I then reference this .dll in .aspx (See code below). Now, when i try to access this through webserver for drag and drop files i get following errror - The type of the first permission  that failed was : System.Security.Permission.FileIOPermission.

How do I handle this, so that drag and drop of files can happen over the webpage residing at webserver.

namespace testWinControl1

{

Accessing window control library .dll from .aspx page

  


I have a control in a 'window control library' which handles - 'drag and drop' files from computer to a listbox control, I then reference this .dll in .aspx (See code below). Now, when i try to access this through webserver for drag and drop files i get following errror - The type of the first permission  that failed was : System.Security.Permission.FileIOPermission.

How do I handle this, so that drag and drop of files can happen over the webpage residing at webserver.

namespace testWinControl1
{
    public partial class UserControl1 : UserControl
    {
        private string appTitle = "DragnDrop Files";
        public UserControl1()
        {
            InitializeComponent();
        }
        private void button1_Click(object sender, EventArgs e)
        {
      

Accessing 'Window Control Library' .dll from a .aspx page on webserver

  
I have a control in a 'window control library' which handles - 'drag and drop' files from computer to a listbox control, I then reference this .dll in .aspx (See code below). Now, when i try to access this through webserver for drag and drop files i get following errror - The type of <label style="color:red;">the first permission  that failed was : System.Security.Permission.FileIOPermission.</label>



How do I handle this, so that drag and drop of files can happen over the webpage residing at webserver.



namespace testWinControl1

{

    public partial class UserControl1 : UserControl

    {

        private string appTitle = "DragnDrop Files";

        public UserControl1()

        {

            InitializeComponent();

        }

       &nbs

Accessing 'Window Control Library' .dll from a .aspx page on webserver

  


Accessing 'Window Control Library' .dll from a .aspx page on webserver
I have a control in a 'window control library' which handles - 'drag and drop' files from computer to a listbox control, I then reference this .dll in .aspx (See code below). Now, when i try to access this through webserver for drag and drop files i get following errror - The type of the first permission  that failed was : System.Security.Permission.FileIOPermission.

Accessing 'Window Control Library' .dll from a .aspx page on webserver

  

I have a control in a 'window control library' which handles - 'drag and drop' files from computer to a listbox control, I then reference this .dll in .aspx (See code below). Now, when i try to access this through webserver for drag and drop files i get following errror - The type of the first permission  that failed was : System.Security.Permission.FileIOPermission.

How do I handle this, so that drag and drop of files can happen over the webpage residing at webserver.

namespace testWinControl1

{

    public partial class UserControl1 : UserControl

    {

        private string appTitle = "DragnDrop Files";

 

        public UserControl1()

        {

            InitializeComponent();

        }

 

        private void button1_Click(object sender, EventArgs e)

        {

            label1.Text = "Hello world!";

        }


Setting Task Field Values in Custom .aspx Edit Form and accessing through ExtendedProperties

  

Since we're using WSS 3.0 and not MOSS 2007, we have to create and use ASP forms for any custom Workflow Task Edit pages instead of being able to use InfoPath forms (which would be nice...maybe some day we'll step up to MOSS). The custom Workflow Edit Pages are used for custom Task Content Types that we create so that our Workflow Tasks can have additional fields beyond the standard Workflow Task fields. Once you've collected the values for the Task fields from the user on the ASP Workflow Task Edit form, the typical procedure is to create a hashtable and fill the hashtable with key/value pairs that represent the names of your Task fields and their associated values, as such:

// This function is called when the user clicks the Save/Submit button
// on the Custom Task Edit ASP form
public void btnSubmit_Click(object sender, EventArgs e)
{
  // Create a hashtable that will be used to update the values of task fields
  Hashtable taskHash = new Hashtable();
  // For each field, create two values in the hashtable. If the field name 
  // matches a field in the Task content type, the field name will not be 
  // searchable as a key within the ExtendedProperties hashtable. So 
  // create a second field that is a duplicate of the first but having a 
  // name that doesn't exactly match an existing field in the Task 
  // content type. That way it will be a searchable ke

Accessing solution properties in code at design time

  

Hello all,

We have a project working with WCF embedded in a WindowsService. To facilitate testing, we have a Client Form and a Host Form. This project has multiple WCF services so we have 4 ClientForms and 4 HostForms. We are using multiple start up projects in the solution which is accessed by right clicking the Solution file at design time and selecting multiple clients and hosts. I would like to put that functionality on a form to allow dynamic switching (eg a series of check boxes for Client1, Host1, Client3, Host3, etc).

I'm guessing this pertains to using EVNDTE but I have not used that very much recently. Can this be done fairly easily, and if so, would someone be kind enough to post some code to get me started? Thanks in advance for any ideas and / or suggestions!


Have a great day!

Accessing window control library .dll from .aspx page (ActiveX)

  

I have a control in a 'window control library' which handles - 'drag and drop' files from computer to a listbox control, I then reference this .dll in .aspx (See code below). Now, when i try to access this through webserver for drag and drop files i get following errror - The type of the first permission  that failed was : System.Security.Permission.FileIOPermission.

How do I handle this, so that drag and drop of files can happen over the webpage residing at webserver.

 

namespace testWinControl1
{
    public partial class UserControl1 : UserControl
    {
        private string appTitle = "DragnDrop Files";
        public UserControl1()
        {
            InitializeComponent();
        }
        private void button1_Click(object sender, EventArgs e)
        {
 &nb

Accessing the different controls inside a GridView control

  
how we can access a particular control which resides inside a GridView control. In this article I will show you how you can access different controls inside a GridView control. We will see how we can access a TextBox control, a DropDownList control and a ListBox control. If you are working with ASP.NET 1.X then you might want to check out my article Accessing Different Controls Inside a DataGrid.

WCF Tip: Using Properties in Service Contracts

  
you'll notice all of the Service Contracts are implemented with interfaces containing only methods. For the longest time I thought that's all that was supported, until I thought about it a little more. In C# land, properties are simply wrappers around a get method and set method, so why wouldn't we be able to use properties in a service contract? Well the answer is we can.

Automatic vs Explicit Properties

  
If the reason that motivated the change from automatically implemented property to explicitly implemented property was to change the semantics of the property then you should evaluate whether the desired semantics when accessing the property from within the class are identical to or different from the desired semantics when accessing the property from outside the class.
Categories: 
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