Site: http://nayyeri.net/ Link: http://nayyeri.net/rss.aspx
by Keyvan Nayyeri via Keyvan Nayyeri on 5/9/2009 2:13:15 AM
After discussing custom route handler and IRouteHandler as two extensibility points in ASP.NET MVC to customize the behavior of routing system, now I want to continue discussing thirteen major extensibility points in ASP.NET MVC by focusing on custom controller factories and building such controller factories. When ASP.NET MVC receives a request, it needs to manage how to handle it with a specific controller and the action methods in it. The component that is responsible to map an incoming requ ...
[ read more ]
by Keyvan Nayyeri via Keyvan Nayyeri on 4/27/2009 4:52:37 PM
In my last post I covered one of the nice extensibility points in ASP.NET MVC to customize route constraints in your MVC applications. I also said that I’m going follow the rich set of extensibility options listed by Simone to write more posts about the topic of ASP.NET MVC extensibility. Now it’s the second post that covers IRouteHandler interface as another extensibility point in the area of routing that provides a lower level of customizability for developers. This interface is actually an o ...
by Keyvan Nayyeri via Keyvan Nayyeri on 4/15/2009 3:54:11 PM
In a recent blog post Simone did a great job by listing all the 13 major extensibility points available in ASP.NET MVC with a short description and references for further reading. It’s been a while that I wanted to write more about ASP.NET MVC but like all other topics, it has been a decision only! However, I thought that it’s a good start point to go over these extensibility points with some introductory posts as starter guides. So here is the first part covering custom route constraints in AS ...
by Keyvan Nayyeri via Keyvan Nayyeri on 2/23/2009 6:14:11 PM
In one of my recent blog posts I talked about IOperationBehavior interface as an extensibility point to customize operation behavior in Windows Communication Foundation. There I pointed that this interface works in conjunction with various options in WCF to expand the existing features on service and/or client side. In this post I’m going to cover one of these extensibility points. As I said in that post, one of the most notable points about WCF is the level of customizability that it offers fo ...
by Keyvan Nayyeri via Keyvan Nayyeri on 2/19/2009 3:22:16 PM
Windows Communication Foundation is one of the top technologies in the field of flexibility and customizability and those who have worked with this great product already know that a simple task can be done with several ways for different requirements and scales. WCF enables many doors to developers to choose from, and accomplish what they want. Here I want to concentrate on one of these points that allows you to customize operation behaviors on service or client side with the least amount of wo ...
by Keyvan Nayyeri via Keyvan Nayyeri on 1/26/2009 11:49:25 AM
The era of Web 3.0 has begun and there is a fast transition to Web 3.0 styles and definitions. The recent economy crisis can slow the progress down to a reasonable extent because the nature of Web 3.0 requires good investments by bigger companies in creation of Artificial Intelligence methods that classify the content automatically. However, there is still a good progress in this field, and Web 3.0 is going to become the comprehensive style of websites on the web. As you should know, a major p ...
by Keyvan Nayyeri via Keyvan Nayyeri on 12/6/2008 8:50:37 PM
Office document formats are one of the most common file types among users, especially Word and Excel files that play a very important role in today’s usage of software. I think you rarely can find someone who doesn’t use one of these formats in his daily life. The importance of these document types has had its impact on software development, and it’s been a common task to deal with such documents in different types of desktop, web, or embedded device applications. By the way, here I want to f ...
by Keyvan Nayyeri via Keyvan Nayyeri on 11/30/2008 5:51:22 PM
Debugging is one of the most important yet effective stages of software development, especially when it comes to large scale applications. There are many resources about general debugging topics, concepts, and techniques available out there as well as some that specialize on some software platforms such as the .NET Framework, but debugging, by nature, is something that mandates a level of experience, attention, and knowledge. The processes of catching a defect, finding the real reason, and findi ...
by Keyvan Nayyeri via Keyvan Nayyeri on 9/29/2008 6:37:44 PM
Working with collection types is a common task in modern software development and as a widespread development platform, .NET Framework is coming with a very rich set of collection types and features varying from traditional types such as arrays or ArrayList to modern generic types and very helpful extension methods that are offered for them in .NET 3.5. As we move forward, we feel the necessity of having the capability to apply some operations like sort and search more than the past and accompl ...
by Keyvan Nayyeri via Keyvan Nayyeri on 9/5/2008 2:15:10 PM
This is the first part of a series of a few blog posts that I’m going to write about common string manipulation problems in .NET (especially C#) with some code snippets as their solutions with an emphasis on real world scenarios. The first post is about splitting a text (paragraph, sentence or any piece of text) into words that are building it. This is obviously a common problem and of course, a problem that seems to be solved with some built-in string manipulation methods in .NET. However, ...
by Keyvan Nayyeri via Keyvan Nayyeri on 8/29/2008 5:06:48 AM
Recently I ran in a situation where I had to get the intersection of multiple generic lists in order to filter my final result. I know that there are several approaches to work around this but I was interested to apply the new Intersect extension method in .NET 3.5 and extend it for multiple lists. I can remember the university days when we had to extend a proven theorem for two objects to N objects and this was somehow similar to that! Here I just want to share a code snippet that I used to a ...
by Keyvan Nayyeri via Keyvan Nayyeri on 8/20/2008 6:37:44 PM
Having a powerful and extensible configuration system is a common facet of any application. Almost all the times this configuration system is based on XML files. In .NET world, there is a built-in mechanism for configuration management for application configuration files (App.Config or Web.Config) that lets you add some custom sections as you wish and work with them via a rich set of APIs. But the problem is that this mechanism is limited and for some applications with more configuration prer ...
by Keyvan Nayyeri via Keyvan Nayyeri on 5/30/2008 4:30:17 PM
In the first and second parts of this post about building a provider model from the scratch, I talked about some main steps of the process. In the first part I talked about main classes in the provider model as well as the configuration system and in the second part I talked about the abstract part of the model. Now in the third and last part of this series I want to finish the discussion by giving some details about the latest steps of the process including the implementation of the abstract la ...
by Keyvan Nayyeri via Keyvan Nayyeri on 5/26/2008 1:49:06 PM
Last Friday I started a post series about building a provider model from the scratch. In the first post I gave a quick overview of the steps that should be followed to get this done and then discussed about two topics in details: The first topic was about the main classes that you need to use in the provider model and the second topic was about the configuration system for the provider. And now here is the second part with a detailed discussion about the abstract part of the provider model. Afte ...
by Keyvan Nayyeri via Keyvan Nayyeri on 5/23/2008 4:57:48 PM
A few months ago I wrote a popular article on DotNetSlackers entitled How to Write a Provider Model that described the process of writing a provider model for your .NET applications based on the built-in provider mechanism in the .NET Framework. Publishing that article, I received some feedbacks/requests about the future articles about this topic in more details and in a more advanced level. Some guys were looking for a way to write their own provider model from the scratch. Writing such a provi ...
by Keyvan Nayyeri via Keyvan Nayyeri on 3/8/2008 4:55:13 PM
Introduction of Extension Methods in .NET 3.5 was one of the main new stuff in this version and the main reason was the necessity to have such a feature for LINQ. There have been many articles and tutorials about this new feature and the concept is easy to learn and implement. However, I think that no one can believe the value of this new feature until he or she applies this feature to reduce a lot of existing code written in previous versions of .NET framework. For me this happened today and I ...
by Keyvan Nayyeri via Keyvan Nayyeri on 1/2/2008 8:23:56 PM
[Update: Jason Stangroome and Rich Grenwick left helpful comments. Rich has a good description of the problem, its reason and a fix for that. I applied his recommended code to BlogML test method and it passed successfully.] Some readers may remember my post about the performance comparison between two approaches that I used to unit test BlogML API especially around the list of properties for two objects that have many properties. Recently I got back to my unit testing progress and tried to impro ...
by Keyvan Nayyeri via Keyvan Nayyeri on 12/19/2007 2:44:17 AM
Recently I've been working on a dynamic Windows Application written with Visual Basic to iterate through a huge list of different servers at different locations and upload and download some files to or from them automatically. This applications runs automatically every night to move data to a center and send updated data back to clients. To connect to the remote servers I used a component that was connecting via an asynchronous operation. It means that your code execution can follow while this o ...
by Keyvan Nayyeri via Keyvan Nayyeri on 10/2/2007 4:14:29 PM
Yesterday, Bill Bridges (Development Editor of my new book) sent me an email about a problem in one of the recent chapters of my upcoming book about Visual Studio Extensibility. The problem, that had taken half an hour of his time to get fixed was a simple formatting problem in one of source code samples. A a non-technical man, he was honest to change all lines of a source codes manually one by one. Book publishers like to use spaces for code indentations not tabs. In tha ...
by Keyvan Nayyeri via Keyvan Nayyeri on 10/1/2007 1:58:00 AM
If you do unit tests frequently, know that unit testing a generic list is a very common scenario because generic lists are a common part of today's codes in the .NET world. Testing the equality of two generic lists isn't as easy as easy testing the equality of two objects from two simple types. In order to test two generic lists, you need to follow one of two approaches that I describe in this post. One of them is easy and can be done quickly and the second one may need more effort. ...
by Keyvan Nayyeri via Keyvan Nayyeri on 8/17/2007 6:37:14 PM
Last week, I talked about SendActivity in Windows Workflow 3.5 and today talk about ReceiveActivity. This activity can be used in WCF services in order to listen for a specific service method and handle its logic in a workflow. ReceiveActivity can work as a container for other activities and hold them as part of method logic. It gets method parameters via properties or fields and sets the result of the method in a field or property. When service method is called by the client, ...
by Keyvan Nayyeri via Keyvan Nayyeri on 8/14/2007 5:02:04 PM
One of guys at our military office is learning programming from the base at 25!! Sometimes he asks me some questions and wants me to check his codes. Today he showed me one of his codes for Factorial recursive example and asked a few examples! Seeing his example, I suddenly remembered something that I had read in Code Complete 2 about two silly examples that we see in computer-science textbooks for recursion and they are Factorial and Fibonacci sequence algorithms. Steve McCon ...
by Keyvan Nayyeri via Keyvan Nayyeri on 8/7/2007 5:54:17 PM
Windows Workflow Foundation in .NET Framework 3.5 comes with two new activities: SendActivity and ReceiveActivity. These are two new services to work with WCF services. The first one, SendActivity, can be used to send requests to WCF services and the second one, ReceiveActivity, can be used to receive the response from services. In this post I talk about the SendActivity and in one of upcoming posts, I'll cover ReceiveActivity. Create a Service First, let me create a WCF service for ...
by Keyvan Nayyeri via Keyvan Nayyeri on 7/12/2007 12:34:47 PM
In the past, I gave an introduction to custom workflow runtime services and how to create a custom workflow runtime service. In this post, I want to talk about adding and removing services to or from workflow runtime. This is very simple. All you need is calling the AddService or RemoveService() methods of workflow runtime and passing an instance of your custom runtime service to them as shown in below example. static void Main(string[] args) { using(WorkflowRunti ...
by Keyvan Nayyeri via Keyvan Nayyeri on 7/9/2007 3:43:16 PM
As mentioned in the previous post, it's possible to create a custom workflow runtime service in two ways: deriving from a built-in runtime service or create a custom workflow runtime from an upper level by deriving from WorkflowRuntimeService class. In both cases you need to create a class and inherit it from one of base classes then override some or all of their methods based on your needs. Apparently developing a runtime service based on WorkflowRuntimeService is harder than other b ...
by Keyvan Nayyeri via Keyvan Nayyeri on 7/9/2007 3:20:56 AM
The ability to upload files to a weblog and manage them via folders is a new feature in Community Server 2007 that is accessible via control panel and Manage Blog Files menu. There are some newly added APIs to work with these folders and files for each particular blog. In this post I talk about them shortly. CommunityServer.Blogs.Components.WeblogFile and CommunityServer.Blogs.Components.WeblogFiles are two classes that play a role in this scenario. WeblogFile is the code repres ...
by Keyvan Nayyeri via Keyvan Nayyeri on 7/6/2007 5:47:34 PM
Getting access to a service description information can be a common scenario for some situations. Doing this is easy in Windows Communication Foundation. There is a built-in mechanism to do this via the OperationContext class. By creating an OperatingContext object for current context and using the Description property of its Host property you have access to some properties and methods to deal with service description. As an example, suppose that I have a service operation like ...
by Keyvan Nayyeri via Keyvan Nayyeri on 6/24/2007 3:57:16 PM
By default WCF uses a buffered mechanism to send or receive messages to or from services. It means that messages can't be accessed before they arrive to service or client completely. But it's possible to choose streaming mechanism to send or receive messages. This way, messages will be streamed and can be accessed before they arrive completely to service or client. You can use streaming for requests only, responses only or both. Implementing this mechanism is very ea ...
by Keyvan Nayyeri via Keyvan Nayyeri on 6/18/2007 4:00:20 PM
Back in December 2006, I wrote two posts about dynamically modifying a workflow from the inside and dynamically modifying a workflow from the outside. They're descriptive enough to show how to modify a workflow with either ways but what will you do if you want to prevent a workflow from being modified? In this post, I'll show you how to disable modifiability of a workflow. To demonstrate how to control the modifiability of a workflow, I use the sample workflow that I wrote to show ho ...
by Keyvan Nayyeri via Keyvan Nayyeri on 6/11/2007 5:18:53 PM
IP banning is a commercial feature of Community Server which is available in commercial versions (I don't know if it's still a commercial feature in 2007 or not). However, the topic of this book is working with IP banning features in Community Server API and code. IP banning has its own namespace located at CommunityServer.IPBanning and all IP banning classes are located at CommunityServer.IPBanning.Components. As a background, you have to know that it's possible to block a ...
by Keyvan Nayyeri via Keyvan Nayyeri on 6/9/2007 6:10:22 PM
The lowest level of working with elements in WPF is applying on demand rendering techniques to customize the look and feel of an element when it's being rendered. Using on demand rendering, you can change the way that an element is rendered in several ways. On demand rendering is nothing more than overriding some methods from base classes in control hierarchy. The most common method to override is OnRender(). But you can also override some other methods based on ...
by Keyvan Nayyeri via Keyvan Nayyeri on 6/2/2007 5:26:09 PM
[Update: Jason Stangroome has a valuable comment on my post to improve its performance.] While unit testing BlogML project, I faced with some classes that hadn't overridden Object.Equals() method to let me run my tests so I had to override this method for them. For some classes with a few properties this was easy but suddenly I saw a few classes with more than 3-4 properties and class itself was a collection. Thus, I had to iterate through its items and check them one ...
by Keyvan Nayyeri via Keyvan Nayyeri on 6/1/2007 4:01:41 PM
It seems that my CS Dev Guides aren't updated for a while! Let me return to CS Dev Guide with a post about file gallery API. At first glance, file gallery API appears to be different from other APIs but this difference is only and only in naming. As you saw previously in my forgotten CS Dev Guide series, each section is derived from CommunityServer.Components.Section base class and is named based on that particular application for example, Weblog or Forum. On the othe ...
by Keyvan Nayyeri via Keyvan Nayyeri on 5/28/2007 4:44:23 PM
Running a WCF service from a COM+ component is one of main aspects of integration between WCF and other technologies. Building a WCF service based on a COM+ component is a straightforward task. There are a few steps to follow in order to get this done. First you need to create a COM+ component and implement your code logic from an interface. Then register your COM+ component in GAC and create a web directory for it. And finally use ComSvcConfig command to ...
by Keyvan Nayyeri via Keyvan Nayyeri on 5/25/2007 4:24:18 AM
Back in December 2006 I linked to Thom Robbins' blog post about integrating WCF with ASMX services. The other side of integration between WCF and ASMX services is integration between WCF clients and ASMX services which is the title of this post. First I create an ASMX service to build my WCF client for it. using System; using System.Web; using System.Web.Services; using System.Web.Services.Protocols; [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(Confo ...
by Keyvan Nayyeri via Keyvan Nayyeri on 5/15/2007 6:08:46 PM
Back in Beta days of .NET Framework 3.0, I wrote a blog post about commands in WPF and how easy it is to add common commands to your WPF menus and create custom commands to use them. On the other hand, so far I've written some posts about writing a custom WPF control: How to Create a Custom WPF Control How to Add Properties to Custom WPF Control How to Add Events to Custom WPF Control But now and before writing a separate post to show a sample custom WPF control, I want to cove ...
by Keyvan Nayyeri via Keyvan Nayyeri on 5/11/2007 3:57:08 PM
I'm pretty sure that everybody who reads my blog, has good information about transactions and their definitions but in one sentence transactions are a group of operations that act as an atomic unit. WCF supports transaction flows out of the box. But what does transaction flow mean? Transaction flow means that if a client creates a proxy to one or more services and call their operations in a sequence and one of these operations fails then client completely fails. There is a requi ...
by Keyvan Nayyeri via Keyvan Nayyeri on 5/9/2007 7:18:44 PM
I have to change the name of my blog to "Custom Controls"! And this time I want to talk about writing a custom Chameleon control in a new CS Dev Guide. But seriously how can you write a custom Chameleon control?! The first step is to understand the class hierarchy in Chameleon. Chameleon controls are located in some namespaces: There is a general CommunityServer.Controls namespace where you can find all Chameleon base classes and all controls that are used for general purposes ...
by Keyvan Nayyeri via Keyvan Nayyeri on 5/8/2007 6:13:34 PM
So far I've discussed about basics of creating a custom WPF control and how to add properties to it. In this post I want to write about adding events to a custom WPF control. Adding events to custom controls is very similar to adding properties to them in the way that we register them within our control's static constructor. We use RoutedEvents to declare our events. As you may know there are three types of RoutedEvents available in WPF (Bubble, Direct and T ...
by Keyvan Nayyeri via Keyvan Nayyeri on 4/28/2007 6:56:20 PM
In the first post of this series I talked about some principles of creating a custom WPF control. In this post I want to jump in development details by talking about adding properties to a custom control. Normal Properties You know how to write properties for a class in .NET (is there anybody who doesn't know?!). But in WPF most elements use a special type of properties, Dependency Property. WPF uses dependency properties because they provide some extra features that ...
by Keyvan Nayyeri via Keyvan Nayyeri on 4/21/2007 7:05:37 PM
Regular visitors can remember that I had written some posts about writing a custom workflow activity to clarify things. I got good feedbacks for those posts so decided to write a few posts about similar stuff in WPF about building a custom WPF control. So this post and some future posts will cover the topic of different ways of customization in WPF and their different aspects. Building a custom control in WPF isn't as common as building a custom control in other UI engines and t ...
by Keyvan Nayyeri via Keyvan Nayyeri on 4/5/2007 12:41:49 PM
In one of my recent posts I discussed about Invoking a WebService from a Workflow. The other case is when you want to build a webservice that runs a workflow to return its results. This is the topic of this post but is a little harder than invoking a webservice from a workflow. Create the Workflow Before anything we need a workflow to expose it via our webservice. This step is the main step in building the webservice. First I create a new Sequential Workflo ...
by Keyvan Nayyeri via Keyvan Nayyeri on 3/30/2007 6:55:57 AM
Last week I wrote about an open source project for WCF activities for Windows Workflow Foundation and mentioned that there is a default activity to invoke webservices from them. In this post I want to talk about this topic. Sample WebService To illustrate my purpose I use a simple webservice to get a birthdate and return the age as integer value. Code for webservice is shown below. Later I'll use this webservice to invoke its GetAge() method from my sample workflow. using Syst ...
by Keyvan Nayyeri via Keyvan Nayyeri on 3/15/2007 5:22:42 PM
One of WPF controls that could get my interest was Slider. This control comes to simplify the process of coding for some UI design cases where you need to let your user choose a value and change it and you update your interface based on user's choices. A very common example is a slider control that lets user to zoom in or zoom out to view a photo. Slider is a built-in control in WPF and is easy to use. You can have horizontal and vertical sliders with any custom interval a ...
by Keyvan Nayyeri via Keyvan Nayyeri on 3/10/2007 7:10:02 AM
Previously I discussed about Hosting Windows Forms Controls in Windows Presentation Foundation. This is a more common scenario but in opposite direction you may want to host WPF controls in Windows Forms applications. This is easy, too and I'll talk about it in this post. Like hosting a Windows Forms control in WPF where you could put a WindowsFormsHost element to host your Windows Forms control inside it, you must put an ElementHost control on your Windows Form to host your WPF cont ...
by Keyvan Nayyeri via Keyvan Nayyeri on 2/20/2007 5:15:40 PM
Cool! I'm still here and have enough time to waste with blogging! In one of my recent posts about a free GridView control for Windows Presentation Foundation I stated that previously I was hosting a traditional Windows Forms GridView in my WPF applications to have a GridView. This is a helpful feature since there are some differences in WPF and Windows Forms controls and the ability to host Windows Forms controls in Windows Presentation Foundation can solve some problems in ...
by Keyvan Nayyeri via Keyvan Nayyeri on 2/13/2007 5:53:15 AM
So far I've discussed about these topics about writing a custom workflow activity: How to Write a Custom Workflow Activity How to Write a Validator for Custom Workflow Activity How to Write a Toolbox Item Component for Custom Workflow Activity As I stated in first part there is only one component remained: Designer. In this post I finish this series by discussing about designer component. Designer component is where you can change the visual presentation of an activity. By d ...
by Keyvan Nayyeri via Keyvan Nayyeri on 2/8/2007 8:24:53 PM
Today I was working on a short code to get some data (objects with different properties), add them to a list and bind a GridView to this list. Suddenly I noticed that data should be sorted based on one of properties before binding. This was the first time that I had to sort items in a list because I always had control on my data before getting them and was able to sort them from the original class but this time objects were coming out from somewhere outside m ...
by Keyvan Nayyeri via Keyvan Nayyeri on 2/6/2007 7:57:25 PM
A while back I was working on a custom control to deploy it to my blog but didn't finish it. Today I worked on it again and may add it to this blog after installing first Beta version of Community Server 2007. This control is about referrals. What is a referral? Yes, you know! So I can jump into describing available APIs to work with referrals in Community Server. CommunityServer.Components.Referral and CommunityServer.Components.ReferralSet classes and CommunityServ ...
by Keyvan Nayyeri via Keyvan Nayyeri on 2/4/2007 4:19:06 PM
In previous posts I discussed about Writing a Custom Workflow Activity and Writing a Validator for a Custom Workflow Component. In this post I want to talk about writing a Toolbox Item component for a custom workflow activity and implement it for my sample activity. A Toolbox Item component helps you to manage your activity instance when it's being added to workflow. For example you can use this component to set some initial values for your activity properties or to add som ...
by Keyvan Nayyeri via Keyvan Nayyeri on 1/30/2007 4:42:17 PM
In previous post about Writing a Custom Workflow Activity I talked about writing a basic custom workflow activity in its simplest form. In this post I want to add another component to my custom workflow for validation. Validation component is a good way to avoid some predictable exceptions which come from wrong inputs and cause unexpected state for your application. Using validator component you can avoid these exceptions and give appropriate error texts before compila ...
by Keyvan Nayyeri via Keyvan Nayyeri on 1/29/2007 12:30:18 PM
For many people around the world time zone doesn't matter at all. For some people it's important for their jobs and business but for developers it's just a pain! I can remember many situations that I've gotten in trouble with time zones myself. Two times (before release of Community Server 2.0 and launching BlogMailr) I had some conversations with Ken about them and it's still a big problem for software developers. Many users ask about the lack of their local time zone in ...
by Keyvan Nayyeri via Keyvan Nayyeri on 1/25/2007 7:12:49 PM
Normally writing a custom workflow is a common task in Windows Workflow Foundation because there are many situations that we need to apply a development process to workflows. There are several references about writing a custom workflow but I see many newbies who can't understand the process easily. In my opinion the reason is most resources try to talk about all aspects of writing a custom activity at a glance without simple examples. So I want to test my chance and write about ...
by Keyvan Nayyeri via Keyvan Nayyeri on 1/23/2007 8:15:33 PM
Regular visitors can remember my post about Health Monitoring in ASP.NET 2.0 and my article about Writing a Custom Web Event Provider for ASP.NET 2.0. Event and Exception Logging are common parts of enterprise applications in software world. They show their importance when it comes to distributed systems. Windows Communication Foundation as Microsoft infrastructure for building distributed systems provides excellent means to log everything and monitor your application ...
by Keyvan Nayyeri via Keyvan Nayyeri on 1/21/2007 3:18:45 PM
Using tab controls wasn't so hard in Windows Forms applications. But in Windows Presentation Foundation it's easier. Thank to XAML, you can build a tab control from the scratch with markup codes. Two elements play main roles in building a tab control: TabControl and TabItem. TabControl is the container of one or more TabItem elements. In addition to some attributes that it inherits form its parent, TabControl has a specific attribute and an event handle ...
by Keyvan Nayyeri via Keyvan Nayyeri on 1/11/2007 6:09:22 PM
In addition to site configurations, Community Server provides several settings for each site. Most of these settings have default values and you can set them in Control Panel and web UI. CommunityServer.Components.SiteSettings is a code representation of all site settings for a specific Community Server instance. As you know, several Community Server instances can be installed in same database. Here a property which is named SettingsID comes handy and helps to distinguish e ...
by Keyvan Nayyeri via Keyvan Nayyeri on 1/9/2007 2:41:09 PM
Today I made some changes in my ClientBlocker. This may be the last version of this HTTPModule and I won't update it anymore (because it doesn't need any features though). Using this HTTPModule you can block or trust on single IPs or a range of IPs and also use a free webservice to block site visitors based on their country. In addition to making some minor changes I simplified the source code and solved a major bug. Now it works brilliantly. Main chang ...
by Keyvan Nayyeri via Keyvan Nayyeri on 12/22/2006 8:16:07 PM
As you see my site redirects all requests to any URL with "www." to a URL without it. This is the default behavior in Community Server, Subtext and some other web applications and I saw some sites that are doing this such as ASP Alliance and CSharpFeeds. I wanted to write about this some weeks ago but couldn't find the address of a site which recommends this functionality on internet sites. First time I saw it on Scott Water's blog but that post is not accessible due to a URL Re ...
by Keyvan Nayyeri via Keyvan Nayyeri on 12/21/2006 7:57:57 PM
Sometimes it's necessary to combine two shapes to get a new custom shape. Windows Presentation Foundation and XAML provide all means to do this easily. Using <CombinedGeometry /> element you can combine two shapes in a path. It can combine two shapes via its child elements (<CombinedGeometry.Geometry1 /> and <CombinedGeometry.Geometry2). Each of these elements can get a geometry and their parent, <CombinedGeometry />, can combine them. <CombinedGeom ...
by Keyvan Nayyeri via Keyvan Nayyeri on 12/18/2006 4:09:40 PM
As I described before, TextParts are a special type of TextTokens in blog application. You can use them to create some text shortcuts to replace them with a longer text when post is being rendered. In Community Server 2.1 TextParts are known as Snippets. Overview Before talking about development details it's worth to have a background about TextParts structure. Each TextPart consists of several colon delimited values that build it. For example, suppose this Text ...
by Keyvan Nayyeri via Keyvan Nayyeri on 12/14/2006 3:46:24 PM
Fifth and last part of my tutorials about XAML and Windows Presentation Foundation, titled Events in Windows Presentation Foundation, has been published on ASP Alliance. The way that events are handled in user interface is enhanced in Windows Presentation Foundation and .NET 3.0. Different routing strategies, different event argument types and different events let you to build powerful user interfaces which were so hard to build with older graphic user interfaces. In this article Keyvan discuss ...
by Keyvan Nayyeri via Keyvan Nayyeri on 12/13/2006 6:57:00 PM
It's possible to use ASP.NET membership and role providers for authentication and authorization in Windows Communication Foundation. To enable ASP.NET membership for authentication you need to modify service configuration file and add appropriate items for ASP.NET membership to it then set Windows Communication Foundation configurations to use it. For example here I add connection string for my SQL Server database to use its membership data for authentication: <connectionStrings> &nb ...
by Keyvan Nayyeri via Keyvan Nayyeri on 12/8/2006 6:10:07 PM
TextToken is another feature in Community Server and has special implementations in some applications. For example TextParts (which are now renamed to Snippets in Community Server 2.1) are their implementation in weblog application. I can remember this feature in .Text, too. If you want to know what they do, they let you to use some text keys and corresponding values in your application or specific sections. When you put one of these key texts in your post bodies ...
by Keyvan Nayyeri via Keyvan Nayyeri on 12/7/2006 5:04:44 PM
We're close to a new release of our Windows Live Writer plugins project and I wanted to add a new plugin to this release. One of things that I use on my blog is XFN relationships. Inserting an XFN relationship link requires adding appropriate relationships as text values to rel attribute of a link. I was putting these texts manually but due to the number of defined relationships in XFN I decided to write a simple plugin for Windows Live Writer to make this process easi ...
by Keyvan Nayyeri via Keyvan Nayyeri on 11/27/2006 4:51:59 PM
Tags are a new feature in Community Server 2.1. Generally tags became a frequently used feature in web applications and websites in latest 2-3 years and Community Server team decided to implement them for this great up to date platform. In previous versions of Community Server, each application type had its own mechanism to categorize its content. Categories for blog posts and subfolders of file gallery folders were two examples of these mechanisms. But in Commun ...
by Keyvan Nayyeri via Keyvan Nayyeri on 11/22/2006 7:08:15 PM
Often building an application is as easy as a click Visual Studio but sometimes custom builds are required to create an application. If you install .NET Framework 3.0 and Windows Presentation Foundation add-in for Visual Studio 2005, can build your applications via Visual Studio. But like all other .NET applications, it's possible to build your Windows Presentation Foundation applications using MSBuild. In this post I introduce this topic. First I create a very simple Windo ...
by Keyvan Nayyeri via Keyvan Nayyeri on 11/18/2006 6:57:10 PM
Team Foundation is a great but sometimes its client, Team Explorer, isn't easy to use. Although all common scenarios are possible to accomplish in Team Explorer but some of them aren't easy to find. One of things that every developer does is changing Local Folder for his projects. A few months ago I had to do this and it took about 20-25 minutes to find solution. Today I had to do it again but had forgotten the solution (but could find it sooner!). However, if yo ...
by Keyvan Nayyeri via Keyvan Nayyeri on 11/17/2006 5:57:52 AM
Poll is a very nice feature in Community Server and I love it. Having a powerful voting system in forums (which is available through APIs to other applications) is very helpful. Working with polls via APIs can be a real world scenario because some people ask for poll functionality in blogs on Community Server forums. Actually I haven't implemented a voting system for blog with Community Server APIs to be aware of any possible error or issue for working with them but provided methods ...
by Keyvan Nayyeri via Keyvan Nayyeri on 11/11/2006 4:17:53 AM
I always was using DESCryptoServiceProvider and TripleDESCryptoServiceProvider classes regardless of their common property and method names but as they're not inherited directly from a same base class, ignored these common names. Yesterday I came up with a class to encrypt and decrypt my streams which is named SymmetricAlgorithm and is actually the base class for DES and TripleDES classes. Now this base class is a better choice for me for cryptography. This class is the base class f ...
by Keyvan Nayyeri via Keyvan Nayyeri on 11/8/2006 5:49:00 PM
You know Community Server has a default search engine (Search Barrel) and a commercial Enterprise Search engine. It's also possible to write custom search engines for it. But there are some cases when you need to search with APIs and use search results in your custom modules or controls so it's worth to talk about search APIs in this post. Whether you use default Search Barrel, Enterprise Search or any other search engine, can access to your application search results through sa ...
by Keyvan Nayyeri via Keyvan Nayyeri on 11/1/2006 7:37:57 PM
You already know that visualizers are good tools to debug your code in Visual Studio 2005. Each visualizer works for a specific type and lets you to monitor some specific properties of an instance of classes in a visual manner. Fortunately there are many built-in visualizers as well as visualizers that are written by community for common types. One of cool and famous visualizers is created by Roy Osherove for Regular Expressions and I had blogged about it before. But ...
by Keyvan Nayyeri via Keyvan Nayyeri on 10/24/2006 4:30:07 AM
One of useful improvements in .NET was around SecurityException class. Newly added properties are really helpful to work with security exceptions. Previously this object had only four properties but now it comes with several properties (in addition to some properties that it inherits from SystemException) which are listed here: Action (new): SecurityAction that caused this exception. Demanded (new): Gets or sets the permissions, permission sets or permission ...
by Keyvan Nayyeri via Keyvan Nayyeri on 10/20/2006 7:38:57 PM
In this post I talked about SqlTrackingService in Windows Workflow Foundation which helps you to track information about your workflows. By default Windows Workflow Foundation uses a TrackingProfile object to track your workflows and stores all common and important information for you. But you can define your own TrackingProfile to track custom information about your workflow instances. Data for default TrackingProfile and custom TrackingProfiles will be store ...
by Keyvan Nayyeri via Keyvan Nayyeri on 10/16/2006 7:00:08 PM
I haven't used Trillian for more than two weeks. One of features that I like in Trillian but isn't available in other instant messengers such as Windows Live Messenger or Yahoo Messenger is Auto-Responder. I'm usually in front of my PC or laptop but there are sometimes that I'm away or am working on a machine which doesn't have Live Messenger installed. So this add-in could be useful for my Live Messenger. I searched for this add-in but couldn't find any result. ...
by Keyvan Nayyeri via Keyvan Nayyeri on 10/6/2006 5:19:23 PM
As long as you work with Community Server, can find new great features that you didn't know about before. One of them that most users miss and make their life harder is the ability to mark a post, section or user as favorite. This helps you to come back to any stuff you like in future. You'll agree with me about the necessity to know about development of this part when I give you a real story: Last week one of Community Server forum users asked us about the ability to mark a blog pos ...
by Keyvan Nayyeri via Keyvan Nayyeri on 10/4/2006 2:33:00 PM
Notice the usage of List<T>.ConvertAll() method in my previous post: public String Points { get { return String.Join(" | ", (String[])this.myStudent.Points.ConvertAll (new Converter<Double, String>(delegate(Double value) { & ...
by Keyvan Nayyeri via Keyvan Nayyeri on 10/4/2006 1:30:15 PM
By default Visual Studio nests object properties in Watch Window and shows them in a hierarchy manner. For more complex objects you need to traverse through your properties to find whatever you like. This can be a pain when there are several unimportant properties for an object. But there is a simple way to see what you need in Watch Window. In order to be able to retrieve your desired properties with a pattern you like from an object in debugger, you only need t ...
by Keyvan Nayyeri via Keyvan Nayyeri on 9/25/2006 7:41:01 AM
I hadn't attended to these simple validators in System.Configuration. Although they seem to be behind the scene part of configuration APIs but can be helpful in some cases. All these validators are inherited from System.Configuration.ConfigurationValidatorBase. You can find some validators such as DefaultValidator, IntegerValidator, LongValidator, RegexStringValidator, StringValidator, TimeSpanValidator, SubClassTypeValidator and TypeSpanValidator there. They all have a CanValidate() ...
by Keyvan Nayyeri via Keyvan Nayyeri on 9/19/2006 7:27:49 PM
Alexey had two informative comments (1, 2) for one of my recent posts about using StringWriter and XmlTextWriter to generate XML files on fly. He had pointed me to an article on MSDN about some better alternatives for objects I had used in my code in .NET 2.0. He recommended me to use XmlWriter, XmlReader and XPathDocument instead of XmlTextWriter and XmlDocument. Before stepping in details I should send my thanksgivings to him (if he hadn't sent these comments, I ...
by Keyvan Nayyeri via Keyvan Nayyeri on 9/18/2006 5:38:20 AM
This is just my favorite way to generate XML files on fly. Often I need to create an XML file in memory independent from a file. To do this I use StringWriter in conjunction with XmlTextWriter to generate my XML file as string. This approach has some issues for encoding since .NET uses UTF-16 encoding for strings. You can follow Robert's post and its comments for more information. The process to generate an XML file with this approach is so easy: create a StringW ...
by Keyvan Nayyeri via Keyvan Nayyeri on 9/15/2006 3:01:34 PM
This week we haven't had CS Dev Guide show but let's finish it with a useful show for the Community Server world to kill spams and help our news man to feed his Daily News. Community Server 2.1 came with great features for spam blocking and this functionality is absolutely better than 2.0. Nice point about Community Server 2.1 is you can write your own spam rules to fight with spammers. I first highlight the steps to write a spam rule: Create a Class Library project. Imple ...
by Keyvan Nayyeri via Keyvan Nayyeri on 9/14/2006 9:31:48 AM
This topic is covered by others before but this post by Rick pinged me to write about it to give an introduction for one of my incoming posts. Rick as an administrator for a shared host, ASPnix, has disabled debugging on their servers but their clients got in trouble to debug their applications and are looking for a way. Rick contacted Scott and he suggested to use ASP.NET 2.0 Health Monitoring feature then create a simple reporting system to let users be aware of their application errors. ...
by Keyvan Nayyeri via Keyvan Nayyeri on 9/13/2006 6:55:19 AM
It helped me a lot today. I knew it's useful but now I'm sure it's twice useful!! ASP.NET 2.0 comes with a cool new feature that lets you to deal with configuration files on fly via APIs. You can read a configuration file then modify it through your codes. Alright, this isn't something new for a real .NET 2.0 developer but I have to point it again! You can read configuration files from remote server. System.Web.Configuration.ConfigurationManager.OpenWebConf ...
by Keyvan Nayyeri via Keyvan Nayyeri on 9/9/2006 6:39:35 PM
Creating a ToolBar is easy and sweet in Avalon. Using XAML markups or Avalon codes you can create a ToolBar quickly. In this post I introduce this control in Avalon. ToolBar in XAML Building a simple ToolBar is as easy as writing a <ToolBar /> element. Except some common attributes this element has following important attributes for its own: IsOverFlowOpen: A Boolean value that specifies the position of ToolBarOverflowPanel at start. Band: Determines the posit ...
by Keyvan Nayyeri via Keyvan Nayyeri on 9/8/2006 4:42:34 PM
Configuration is the key part of any application to make it works for user needs. Community Server uses communityserver.config file as the main configuration file. There are some options that can be configured via Control Panel as well. Any developer who needs to get information about Community Server configuration as can accomplish this very easy via APIs. All the configurations in communityserver.config file are accessible via a set of ReadOnly properties in CommunityServ ...
by Keyvan Nayyeri via Keyvan Nayyeri on 9/6/2006 8:37:09 AM
I announce new version of my Community Server BlogML Converter just some hours after announcing BlogML 2.0. New version of my converter is a good improvement in previous one since BlogML is improved and I could implement all new features in my converter. New converter has some bug fixes to help users import/export their content easier. Community Server BlogML Converter was my test project in BlogML project to apply latest changes and see what will happen. Fortunately previous versio ...
by Keyvan Nayyeri via Keyvan Nayyeri on 9/6/2006 5:54:29 AM
Finally third version of BlogML released (0.9, 1.0 and now 2.0). After moving BlogML project to CodePlex we started working on new version with new features and bug fixes. The most important change was it became really Open Source and some guys like me could join it. As I mentioned in one of my previous posts and add some new items now, version 2.0 comes with these new features: Multi-author content Post excerpt Blog extended properties Post view statistics Post n ...
by Keyvan Nayyeri via Keyvan Nayyeri on 9/5/2006 9:54:48 AM
ACID theory is familiar to many programmers. Those who work on Operating System design concern about it everyday. Most important aspect of ACID is Atomic transactions. But what's an Atomic transaction? The best way to describe it is a famous common example: a bank accounting system. Consider that bank A and bank B want to interact with someone's account at same time. Both banks want to withdraw from account and account has $10.00 currently. If bank A ...
by Keyvan Nayyeri via Keyvan Nayyeri on 9/1/2006 5:15:33 PM
Any web application needs a way to send emails to different kinds of its users. This capability is provided in Community Server from early versions. Sending emails is one of easiest parts of Community Server development. To send emails in Community Serve you have two options: using pre-defined email templates for some common situations or create an email manually. First option is easy to implement. Community Server has provided several default templates for your email ...
by Keyvan Nayyeri via Keyvan Nayyeri on 8/30/2006 6:28:00 PM
Some ages ago, when new FeedBurner site had been launched, I wanted to write a component for FeedBurner APIs in .NET but we know "Tomorrow is far away"! Now FeedBurner is a famous site and many users use their services around the web. When Scott Watermasysk opened a feature item for Community Server to add external feed functionality to Community Server 2.1, I commented for him about category feeds and he replied back we should assume this feature just for main fe ...
by Keyvan Nayyeri via Keyvan Nayyeri on 8/30/2006 5:13:44 PM
Finally Microsoft published Express edition of its XNA Game Studio for any .NET developer who wants to write a game. You need to have C# Express and DirectX SDK installed in order to be able to install it. Current version only works with C#. XNA Game Studio Express enables individuals and small teams to more easily create video games using new, optimized cross-platform gaming libraries for Windows and Xbox 360. This beta release targets the development of games for Windows. The ...
by Keyvan Nayyeri via Keyvan Nayyeri on 8/29/2006 1:54:00 PM
Asynchronous execution of commands was one of great new features in ADO.NET 2.0. The ability to execute commands that take long time to execute asynchronously is very helpful for developers. The process of executing a command asynchronously is very simple and easy and I talk about it in this post. Database Before anything I create two stored procedures for SQL Server Northwind sample database to have a final stored procedure that takes time to execute. Fi ...
by Keyvan Nayyeri via Keyvan Nayyeri on 8/28/2006 3:09:00 PM
Steven Smith announced ASP Alliance Simple CMS as an ASP.NET 2.0 plugin which can be added to any ASP.NET 2.0 website with Atlas and Atlas control toolkit installed. Simple CMS has following features (via Steve's blog): Allows creation and editing of virtual pages via a web interface Several ATLAS features included SEO optimized – allows any URL name, title, keyword, description tags Master Page Support Theme Support Rich Editor (FreeTextBox) Plug-In architecture &nda ...
by Keyvan Nayyeri via Keyvan Nayyeri on 8/26/2006 6:15:57 PM
Some weeks ago Steven Smith and Gregg Stark started a new website very similar to VBFeeds for C# developers. Read Steven's introduction here. CSharpFeeds is an online aggregator which fetches some active C# blogs and sites content and publish them in one place. This is very common nowadays and DotNetSlackers is the most famous name in .NET community in this category and does it in wide range automatically but CSharpFeeds has a manual process for moderating posts so cont ...
by Keyvan Nayyeri via Keyvan Nayyeri on 8/22/2006 5:03:38 PM
As same as Event Logs, Community Server has its own mechanism to handle application exceptions and log them. Community Server logs all exceptions and save them into database in cs_Exceptions table. These exceptions are available to site administrators via Exceptions Report page in Control Panel (http://[SiteAddress]/ControlPanel/Tools/Reports/ExceptionsReport.aspx). All you need to deal with any kind of exception in Community Server is an object, CommunityServer.Components.CSExceptio ...
by Keyvan Nayyeri via Keyvan Nayyeri on 8/21/2006 6:45:00 PM
Generics were of one of main new features in .NET 2.0 languages. In .NET 1.x developers had to use System.Collections non-Generic collections to save their objects but no type checking were occurred for them. Therefore they had to do a type casting when they were retrieving their objects from collections. Now that Microsoft introduced Generics as a type specific alternative for those old means, life is pretty easier for each developer. One of most important reasons to use Generics instead o ...
by Keyvan Nayyeri via Keyvan Nayyeri on 8/20/2006 10:10:00 AM
One of several reasons to add Medium Trust level (any search for a good resource except MSDN points me back to my post!) to ASP.NET 2.0 was a new addition to System.Security namespace and it was AccessControl. There you can find essential means to work on file permissions and ACL which opens dangerous wholes in some cases such as shared hosts. By creating a FileSecurity object you can get full information about ACL for a specific file. I begin with getting Access Control ...
by Keyvan Nayyeri via Keyvan Nayyeri on 8/15/2006 8:48:00 PM
As I stated yesterday Microsoft announced Beta version of its Windows Live Writer a blog client. Most parts of this client are written in .NET and this enabled everyone to write his own plugins for it. Today Jayson and I were chatting about lack of Currently Playing song functionality in Live Writer (it's one of cool features in BlogJet and W.Bloggar) and decided to have a competition to write its plugin for Live Writer ourselves. I started working on Windows Media Player pl ...
by Keyvan Nayyeri via Keyvan Nayyeri on 8/14/2006 2:55:52 PM
To complete my post about writing a CSJob I publish a real job here. This job tries to get the list of all comment and trackback spams in all blogs on a site and sends an email which contains name and url of spams to all owners of that blog. Having good information about spammers is worth thing for bloggers. The importance of this job is to help site owners analyze their blog spammers and use good strategies to block them. This is the source code of my job: public class ReportM ...
by Keyvan Nayyeri via Keyvan Nayyeri on 8/11/2006 8:32:57 AM
As I said before one of new features in new version of BlogML is Blog Extended Properties. Extended Properties are a collection of property names and their corresponding values about blogs. Recently I tried to implement them in .NET APIs. At first glance I started with IDictionary<string, string> and implemented this interface and inherited my Extended Properties class from this base class but after seeing this post from Darren, removed that implementation and tried NameVa ...
by Keyvan Nayyeri via Keyvan Nayyeri on 8/7/2006 6:50:35 PM
One of cool features in ASP.NET is HttpCapabilitiesBase class. This class contains tons of common properties to give back several useful information about client browser to web developers. It can be more than what it seems to be when you can generate different content for search engines and avoid rendering some unnecessary data such as Ads and external links for them by using HttpRequest.Browser.Crawl Boolean property to have a better simpler index in sea ...
by Keyvan Nayyeri via Keyvan Nayyeri on 8/6/2006 3:51:38 PM
Run++ 0.9.0.0 has been released. Run++ is a .NET 2.0 (C# Express) powered tool which can be replaced with Windows default Run command to enable several new useful features for users. For command folks, like myself, it can be a very handy tool. + Title suggests a Science-Fiction stuff, doesn't it?! ...
by Keyvan Nayyeri via Keyvan Nayyeri on 8/2/2006 6:07:07 PM
One of complicated things for developers who don't know the structure of Community Server is working with site locations and urls because they can't handle everything when someone changes site urls (i.e. blogging at root). These guys have missed an important part of Community Server APIs, CommunityServer.Components.SiteUrls. To be able to use the functionality of this namespace you need to create an instance of SiteUrls by calling Instance() method of it then get several urls in Community S ...
by Keyvan Nayyeri via Keyvan Nayyeri on 7/28/2006 2:52:07 PM
I modified my ClientBlocker HTTPModule to handle some unexpected manners. I had a mistake in exception handling (actually I forgot to call a method on exceptions) which lets blocked clients to pass this blocker and see the site but by some small changes it should work correctly now. Another change is it returns 200 status for response if client is blocked. void context_BeginRequest(object sender, EventArgs e) { try { &nbs ...
The content of the postings is owned by the respective author. CSharpFeeds is not responsible for the contents of the postings. This site is automatically generated and cannot be reviewed for abusive content. If you find abusive content on CSharpFeeds, please contact us. Designated trademarks and brands are the property of their respective owners. All rights reserved.