Does Anyone Know A Good Practice To Use When Developing For The System.directory Services Class

Jan 31, 2011

I'm trying to create a data access later using System.DirectoryServices. I'd like to use the MVC 2 framework and have all my views be mostly strongly-typed. Does anyone know any good way to this?

For example I started creating a Group Entity:

public class Group
{
public string DistinguishedName { get; set; }
public string GroupName { get; set; }
}

And an abstract interface:

public interface IGroupRepository
{
List<Group> Groups { get; }
}

I am confused about developing the GroupRepository using the system.directory services. Connecting to a SQL database is easy there are examples everywhere but I have no been able to find any using the System.directory sevices in conjunction with a class using MVC. Has anyone tried to do something like this?

View 1 Replies


Similar Messages:

Active Directory/LDAP :: Using System.directory Services Namespace In Framework 2 To Query Active Directory?

May 5, 2010

I am using System.directory services namespace in framework 2 to query active directory. I have used fixed user account impersonisation in the web.config file, find the code:

<identity impersonate="true" userName="enterprise ang09" password="Telcome123"/>
<authentication mode="Windows"/>

I have disabled anonymous access in IIS. Also i have given Read & write access to the account tang09 for the website virtual directory and Microsoft.NET folder located in windows folder. But still i get prompted for the domain username and password to access the website.

View 4 Replies

Active Directory/LDAP :: Using Directory Entry Of System.Directoryservices Class?

Sep 9, 2010

I am using Directory entry of System.Directoryservices class of Asp.net for authenticating against Sunone LDAP server. The following works fine.

DirectoryEntry entry = new DirectoryEntry("LDAP://SunOne2:42028/dc=domain,dc=com");
entry.AuthenticationType = AuthenticationTypes.None;
entry.Username = "uid=thost,ou=people,dc=domain,dc=com";(replaced original values)
entry.Password = password;
entry.RefreshCache();

Now I want to be able to authenticate all the users of different organisation units. e.g. ou=development,ou=accounting etc., So I specified like this, entry.Username = "uid=thost,ou=people,ou=devlopment,ou=accounting, dc=domain,dc=com"; but it says "There is no such object on the server". I also tried putting ou in URL. I am not sure where should I specify this OUs to make my search broad. I found a lot on internet but no success so far.

View 2 Replies

C# - Why Is System.Data.Services.MimeTypeAttribute Now Only A Class Level Attribute

Apr 7, 2010

I'm getting started with Astoria/ADO.NET Data Services/WCF Data Services. Looking through a lot of the code samples out there, it appears that the MimeType attribute used to be a method level attribute. After installing the latest update, it is now a class level attribute.

If I have more than one Service Operation that I want to return as a certain MimeType, then it appears now that I have to create a new service for each operation. Is this correct?

Most examples are like this:

[WebGet]
[SingleResult]
[MimeType("application/pdf")]
public IQueryable<byte[]> FooPDF()
{
var result = from p in this.CurrentDataSource.MyPDFs
where p.FooID == 2
select p;
return result.Take(1).Select(p => p.PDF);
}

I get "Attribute 'MimeType' is not valid on this declaration type. It is only valid on 'class' declarations." when I compile, because now I can't do this.

Now, I have to do this:

[MimeType("FooPDF", "application/pdf")]
public class FooService : DataService<FooDBEntities>
{
public static void InitializeService(DataServiceConfiguration config)
{
config.SetServiceOperationAccessRule("FooPDF", ServiceOperationRights.All);
}
[WebGet]
[SingleResult]
public IQueryable<byte[]> FooPDF()
{
var result = from p in this.CurrentDataSource.MyPDFs
where p.FooID == 2
select p;
return result.Take(1).Select(p => p.PDF);
}
}

What's worse is that I can't add duplicate MimeType attributes to my class.

View 1 Replies

Good Practice When Retrieving SQL Data?

Jan 19, 2011

I'm currently using the fantastic DorkNozzle 'framework' for building a very basic blog in .NET.My first "self-taught" script is as follows, and is for solely retrieving SQL results.

PHP Code:

<%@ Page Language="C#" MasterPageFile="~/Dorknozzle.master" AutoEventWireup="true" Title="Blog" %>
<%@ Import Namespace = "System.Data.SqlClient" %>
<script runat="server">[code]....

I should change to perhaps improve my coding style, without going down the MVC line just yet?

View 17 Replies

Is This Modified C# Singleton Pattern A Good Practice

Feb 9, 2010

I'm developing a blog application shared by non-profit organizations. I want each organization to be able to change their own blog settings. I have taken a singleton pattern (from BlogEngine.net) and modified it. (I understand that it is no longer a singleton pattern.) I have tested this approach and it seems to work fine in a development environment. Is this pattern a good practice? Are there issues, which may arise when this is placed in a production environment?

public class UserBlogSettings
{
private UserBlogSettings()
{
Load();
}
public static UserBlogSettings Instance
{
get
{
string cacheKey = "UserBlogSettings-" + HttpContext.Current.Session["userOrgName"].ToString();
object cacheItem = HttpRuntime.Cache[cacheKey] as UserBlogSettings;
if (cacheItem == null)
{
cacheItem = new UserBlogSettings();
HttpRuntime.Cache.Insert(cacheKey, cacheItem, null, DateTime.Now.AddMinutes(1),
Cache.NoSlidingExpiration);
}
return (UserBlogSettings) cacheItem;
}
}
}

(Portions of code were omitted for brevity.)

View 3 Replies

Good Practice To Avoid Using Session State In MVC?

Mar 7, 2011

It's not explicitly written somewhere but I felt so after reading few blogs on ASP.NET MVC. Just got curious and thought of asking it here.

UPDATE: I'm not asking about memory/storage/RAM concerns on server. For them, there is a solution to store session out of process. I know that. I'm curious that, are there any scenarios where we had to use Session in WebForms but we can avoid it now in MVC taking benefit of the nice structured way offered by MVC?

View 6 Replies

C# - Is It A Good Practice To Implement Logic In Properties

May 27, 2010

we use ASP.NET with C# and based on open source projects/articles I passed through, I found many properties were including a logic but when I did so the team-leader told me it's not good at all to place logic inside properties but to call the logic through methods...

View 6 Replies

Good Practice - Connection String In Web.config?

Jun 30, 2010

Whats the difference, if in my web.config i use. both works with my code. what is right way of diong it? keeping connection string?

[code]...

View 4 Replies

WCF / ASMX :: Web Service To Inherit From A Custom Base Class That Inherits System.Web.Services.WebMethod Inste...

Oct 18, 2010

Recently, I tried to get my Web Service class to inherit from a custom base class that inherits from System.Web.Services.WebMethod instead of the System.Web.Services.WebMethod directly.

However, I've been getting Error 500.

Public Class Service1
Inherits BaseClass
<System.Web.Services.WebMethod()> _
Public Function GetSessionID() As String
GetSessionID = Me.Session.SessionID
End Function
End Class

public class BaseClass
Inherits System.Web.Services.WebService
public property Property1 as string
public property Property2 as string

End Class

View 6 Replies

C# - Is It A Good Practice To Write HTML Using A StringBuilder In Codebehind

Mar 25, 2010

I'm interested to hear from other developers their opinion on an approach that I typically take. I have a web application, asp.net 2.0, c#.

What I usually do to write out drop downs, tables, input controls, etc. is in the code behind use StringBuilder and write out something like sb.Append("

I don't find myself using to many .net controls as I typically write out the html in the code behind. When I want to use jQuery or call JavaScript I just put that function call in my sb.Append tag like sb.Append("td...onblur='fnCallJS()'.

I've gotten pretty comfortable with this approach. For data access I use EntitySpaces.

I'm just kind of curious if this sort of approach is horribly wrong, ok depending on the context, good, time to learn 3.0, etc. I'm interested in learning and was just looking for some input.

Edit

After reading the comments here it sounds like I should take a look at MVC. I've not done that yet. The only hesitancy in doing so is that the existing project is just that, existing. There is a lot of code already done the way I explained and it is hard to imagine what would be involved in changing it, advantages of doing so, and just learning what that would take.

The other thing I'm taking away from the comments is that my code behind should really not include much of the sb.Append code, whereas now it is filled with it in numerous functions. To me it is not messy but that is because I know what each function does and can look at it and see, oh that writes out x, y, and z.

It's not uncommon for me to just have a div on the .aspx part and then build up the .innerHtml of that with the StringBuilder in the code behind.

View 7 Replies

C# - An ImageMap For A Navigation Menu Considered Good Practice?

Feb 2, 2010

Should I use an ImageMap to create a navigation menu?

View 1 Replies

Visual Studio 2008 - Developing Applications Remotely And Best Practice?

Jul 14, 2010

Can you edit a website (in Visual Studio) on a server from your PC by going:File -> Open Web Site -> File System -> My Network Places -> Entire Network -> Microsoft Windows Network -> FooDomain -> FooServer -> Foo_Public_Shared_Folder (which is actually a web applicaiton in C:InetpubwwwrootfoobarWebApp).I suspect it is bad practice to edit a website that is pubished on a server like this - or at least highly unusual? Would I be right in saying that you should create a new website on your local PC then build and publish to the server in question?

One last point as well -if you need to make a copy of a published website and make some enhancements without losing the original - how can you do this i.e. you don't have the original Visual Studio project only the published site (i.e. this could be made by some web site authoring/wizard tool).

View 3 Replies

Which Pattern Most Closely Matches Scenario Detailed And Is It Good Practice

Mar 6, 2011

I have seen a particular pattern a few times over the last few years. In the UI, each new record (e.g., new customers details) is stored on the form without saving to database. This clearly has been done so not clutter the database or cause unnecessary database hits.

While in the UI state, these objects are identified using a Guid. When these are a saved to the database, their associated Guids are not stored. Instead, they are assigned a database Int as their primary key.

The form can cope with a mixure of retrieved items from the database (using Int) as well as those that have not yet been committed (using Guid).

When inspecting the form (using Firebug) to see which key was used, we found a two part delimited combined key had been used. The first part is a guid (an empty guid if drawn from the database) and the second part is the integer (zero is stored if it is not drawn from the database). As one part of the combined key will always uniquely identify a record, it works rather well.

View 3 Replies

C# - Good Practice To Perform Direct Database Access In The Code-behind Of Webpage?

Jun 7, 2010

I am an experienced developer but I am new to web application development. Now I am in charge of developing a new web application and I could really use some input from experienced web developers out there.

I'd like to understand exactly what experienced web developers do in the code-behind pages. At first I thought it was best to have a rule that all the database access and business logic should be performed in classes external to the code-behind pages. My thought was that only logic necessary for the web form would be performed in the code-behind. I still think that all the business logic should be performed in other classes but I'm beginning to think it would be alright if the code-behind had access to the database to query it directly rather than having to call other classes to receive a dataset or collection back.

View 2 Replies

Good Resources For Learning About Web Services With .NET?

Feb 28, 2010

I'm completely new in web service. I want to study about it and the use it in my web site?

View 4 Replies

WCF / ASMX :: Good Ways To Troubleshoot Issues In Own Web Services?

Aug 21, 2010

I have been working on web services for quite sometime.Have been creating and consuming simple to intermediate levels of web services.But now i want to start using some third party web services.I have got to know that there are good ways to troubleshoot issues in our own web services or any third party web services. For example, if a particular web method was working since 3 months and all of a sudden, it stopped working as expected or its not giving the results now. In these kind of situations, what are the best approaches to troubleshoot the issue.Can someone please share some points on this? May be some right articles having some examples will give me the clear picture.

View 2 Replies

Active Directory/LDAP :: IIS Settings For Directory Services In .NET 2 Framework?

Apr 26, 2010

I have a webpage developed using System.Directory services using C# to query active directory. I do get a window prompting me to enter the network user id and password when i access the page from the network. I have enabled integrated windows authenication and unchecked Enable anonymous access.

how to eliminate the window which prompts for username and password?

View 4 Replies

Active Directory/LDAP :: Directory Services And Iis?

Sep 27, 2010

[Code]....

[Code]....

View 4 Replies

Active Directory/LDAP :: Developing A Network Discovery Utility In VB.NET?

Mar 20, 2011

I am developing a network discovery utility in ASP.NET (VB.NET). The utility would crawl the complete network and find out maximum details about all the devices that

are connected to it. After some research i have found out that i can get the complete information about PCs and Servers using WMI but i am unable to find a way to get

information about other types of network devices such as Network Printers, Routers, Switches, IP Phones, Handheld devices etc. Can anyone point out in the right

View 1 Replies

Web Services - Can A Webservice Class Inherit Page Class?

Jan 6, 2011

i have an application consisting of two asp.net projects. And i have have a BasePage which inherits System.Web.UI.Page and have the class some core logic which i require in all of my pages(Implemented in BasePage.cs). So all my pages inherit this BasePage.cs . Now can an Webservice inherit the same class apart from the normal webservice class System.Web.Services.WebService

View 4 Replies

Developing A Randomization System For Clinical Trials?

May 27, 2010

I am developing a randomization system for Clinical Trials.

I want use the concepts like blocks, seed etc of randomization in the system which I am developing.

View 8 Replies

Architecture :: Developing A Simple System Notification Mechanism

Nov 22, 2010

I'm looking for a simple way of developing "System Notification" in an ASP.NET website, which will consist of two parts: Part 1 - The administrator with go to a special page and enter 3 elements for the notification:

Notification Text (e.g. "System will be down for maintenance next Sunday 11/26/2010 from 1:00 AM to 1:30 AM Pacific Time) Starting date/time when the notification should be displayed (e.g. 11/23/2010 6:00 AM) Ending date/time when the notification should be displayed (e.g. 11/26/2010 1:30 AM) Part 2 - Once the user logs into the website within the above timeframe, the system notification message will appear on the home page. What would be a good architectural location for this?

- A table?
- An html page?
- Part of web.config file?
- A new notification.config file?
- Where else?

View 2 Replies

Design Guidelines For Developing Class Libraries?

Jan 18, 2010

our dev shop uses the naming guidelines as laid out in MS's MSDN content "Design Guidelines for Developing Class Libraries". It's a pain though having to refer to this via the web only. Does anyone know if this content is available in PDF or CHM format? My devs are resisting reviewing the webpage and I think sticking a portable file in their face might be more successful.

View 2 Replies

Webforms - Content Management System - What Is The Good Design Pattern

Mar 19, 2010

We are going to develop content Management System in ASP.net. what is the good design pattern do we need to follow in order to have good design.

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved