Wednesday, December 05, 2007

PageFlow, WorkFlow classes and Designer

Widnows WorkFlow Foundation provides an in-process workflow engine for many classes with visual work flow process in design mode in VS, such as Sequential WorkFlow, Machine WorkFlow, Activities, PageFlow, and so on.

By using the visual designer, you can easily define work flow, process item relationships and constrains as a work flow class. In addition to WWF core WorkFlow classes, other third parties or organizations or open source groups (such as PnP) adds other useful WorkFlow classes. The APS.NET solution I have been working on includes a project with PageFlow class.

The PageFlow class is defined within Microsoft.Practices.PageFlow.WorkFlowFoundation.dll by Microsoft Patterns and Practices group. The problem I encountered is that after I created the project by using Guidance Package Manger Recipe of Add PageFlow Project, I got an error message when I tried to open PageFlow1.cs in design mode in VS, but I don't have problem to compile the project. It looks like that its related designer class is not available.

Actually, the designer class is Microsoft.Workflow.VSDesigner.dll. I have to search for this file first. Then I copy this file to the folder where ...WorkFlowFoundation.dll file sits. After making the designer class directly available to the owner assembly, I can see the class in design mode in VS after I re-open the VS again.

Read More...

Tuesday, December 04, 2007

Add Reference to Visual Studio 2005

I have installed .Net Framework 3.5 in my box (not 3.0) and WCSF for a ASP.NET project based on WCSF. When I tried to use Guidance Package Manger's Add Page Flow Project recipe I got an error and failed to add the project.

I wondered why it failed. It must use some kind template to add project. I then found the template project which has the following references but I cannot see them in my VS Add Reference Dialog window:

<Reference Include="System.Workflow.Activities" />
<Reference Include="System.Workflow.ComponentModel" />
<Reference Include="System.Workflow.Runtime" />

I think that is the reason I get the failure. My direct reaction was that I thought .Net 3.5 may not include or install 3.0 assembly files. That's wrong. From VS Add Reference list, I can see that System.WorkFlowServices.dll is located in C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\, and others which are not in VS's Add Reference window are in ...\v.30 folder.

It must be some settings such as environment or registry settings which make these assembly files visible in VS. I can find where those settings are. Anyway, cut the story in short, I found a msdn link about How to: Add ore Remove Reference in Visual Studio 2005. This web page does provide information on how to add customized assemblies in VS by setting windows registries. I followed the instruction I found that the NUnit and MbUnit assembly files I installed are set in the registry and they are in VS Add Reference window. Here are examples of NUnit 2.4.3 and MbUnit in the current user registry:
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\.NETFramework\AssemblyFoldersEx\NUnit 2.4.3]@="c:\Program Files\NUnit 2.4.3\bin\"
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx\MbUnit]@="c:\Program Files\MbUnit\"

Notice that NUnit is not related to any version while MbUnit is under .Net v2.0.50727. According to the msdn, if you add assembly location folders in HKEY_LOCAL_MACHINE in the same way, any user in the pc then can see these assemblies in VS.

Those are settings for third party to add their assemblies to VS 2005's Add Reference window. However, I still can not find any thing bout Microsoft assembly settings. I know where assembly files are, but I don't know what settings to cause them visible in the VS 2005's Add Reference window. Maybe Microsoft does not want people to mess up third party programs with Microsoft ones.

Anyway, I finally find a way to get them visible in VS 2005. I installed Visual Studio 2005 extensions for .NET Framework 3.0 (Windows Workflow Foundation). The installation did some magic settings and I can add Page Flow Project without any failure and I do see these v3.0 WowkFlow assembly files in VS 2005.

Read More...

Monday, December 03, 2007

ASP.NET Authentication Configuration

I was working on a Web application based on ASP.NET and WCSF. The application has a root virtual path with web.config and several sub-folders for other views. Each sub-folder also contains a web.config file.

Before I introduce authentication and Login to the application. It works fine. However, after I added security checking, I got compiling and running exception error. It complains about any authentication in web.config file. The following is an example error:

Line 107: <authentication mode="Forms">
Error It is an error to use a section registered
as allowDefinition='MachineToApplication' beyond application level.
This error can be caused by a virtual directory not
being configured as an application in IIS.
...EmployeeList\Web.config 37

After about half day investigating, I finally found that the error is caused by authentication defined in multiple web.config files. According to ASP.NET's recommendation, in a forum discussion, the authentication can only be defined in the root web.config for each APS.NET application or machine config file once.

That means I have to move all the authentication configurations to the root web.config file. In addition to that, in my application case, if a client logs out from the security from master page's LoginStatus control, it should be redirected to the main page or LoginPage.

After all these changes, my application works like charm!

Read More...