Friday, September 23, 2011

Adding Attachment Toolbar button to HTML Editor

Requirement
Recently, I was working on a project (ASP.NET) where there was a need to allow business users to design their own html page with some basic html features. In addition they also wanted to add some logo and attachments to their html.


Possible Solution
- Somebody suggested to use sharepoint features, which has lots in inbuilt functionality to manage contents. I did not take this approach because of sharepoint environment management point of view. Its a whole different world to manage. I wanted to keep my solution simple
- Another approach was to bye some html editor product which gives all functionality you need. We did not want to spend money to buy any product on this
- Use AjaxControlToolkit HtmlEditor which gives all basic features and enhance it to add new toolbar button to add attachments and logo. This is the approach we went for.

Solution
Solution basically uses-
1) .NET 4 framework
2) AjaxControlToolkit HtmlEditor
3)  AjaxControlToolkit AsyncFileUpload control
4) jquery ui plug in

The basic design involves of
  • Creating a class for your new htmleditor called (MyHtmlEditor.cs) and extend it from ajaxcontroltoolkit htmleditor class.
  • Override its FillToolBar method to add your new toolbar button
  • Create a new class for your new tool bar button and extend it from MethodButton
  • Override few methods and properties
  • Use embedded resource for toolbar icon, client scipts, so that you can reuse your library anywhere you want
  • You can implement your upload complete event in the way you want, you can save it to database or local server.

You can download the code from the following location

Code to Download














Tuesday, January 11, 2011

Ignoring SQL Stored Procedure result in BizTalk Send port

Problem
Recently one of my colleague asked me a question about the SQL Stored procedure execution in BizTalk Server 2010. His requirement was to ignore the SQL SP results including the returnStatus of the SP, however by default it does not happen. WCF SQL Adaptor expect a subscription to be in place for response of SP for a successful transaction, and incase of its absence sql adaptor transaction fails.
Cause
Why this happens? When you auto generate schemas for a stored procedure using Add Generated Items -> Consume Adaptor Service, the wizard create request response schema of the SPs as shown below.



and a binding file called as "WcfSendPort_SqlAdapterBinding_Custom.bindinginfo.xml"
The binding generated by the wizard is always for two way send port. This is the reason it always expect to have a subscription of the response message.

Solution
The solution to above problem is simple with BizTalk Server 2010 compared to earlier version of it. You can modify the autogenerated binding as follows:
1) set IsTwoWay to "false"
2) comment out "receivepipeline" and "receivepipelinedata" section
Once binding is imported with these changes, send port will be created as one way and it will not expect to have a subscription of response message.
This solution is very well documented on microsoft web site
http://msdn.microsoft.com/en-us/library/dd788154(v=bts.70).aspx.

Sunday, January 9, 2011

BAM Portal Configuration Error on Windows 7

Problem
Recently, I was configuring BizTalk Server 2010 on Windows 7 64bit machine. I encountered an issue while configuring BAM portal on IIS7.

The error you get is "The web site Default web site is not valid"
Cause
IIS7 causes this issue as with default installation mode, BAM portal can not be configured on IIS7.
Solution
In order to solve the issue, you need to switch on the IIS6 Management Compatibility on your machine using following option:
Control Panal -> Programs -> Turn Windows Features on or off -> Internet Information Services as shown below:



Once this is done, BAM portal will be configured without any issue.

Sunday, April 27, 2008

Configuring 2-way SSL on IIS website

Follow the steps below to configure 2-way SSL:
1) To configure a web site on IIS over 2-way SSL, we need two certificates per environment 1) Server Certificate 2) Client Certificate. These two certificates can be obtained via an existing process of obtaining e.g. fromVerisign etc . For testing purpose, we will be using utility makecert.exe provided by .NET SDK.
2.) Creating Server Certificate: A self-signed server certificate can be created using following command:·
makecert -r -pe -n "CN=" -b -e -sky exchange -ss my (local personal store).
Make sure server name or dns name must match the server address used in URL of the site/service.
The above command creates a self-signed certificate and stores it on the Personal Certificate store of the user executing the command.
Once certificate is generated, export the certificate including “private key” from certificate manager console into *.pfx file.
3. ) Creating Client Certificate: A self-signed client certificate can be created using following command·
makecert -r -pe -n "CN=" -b -e -sky exchange -eku 1.3.6.1.5.5.7.3.2 -ss my
The above command will create a client certificate and will store it in current user personal certificate store.
Export the certificates in two files 1) with private+public keys [*.pfx] and 2) without private keys [*.cer]. The *.pfx file is the client certificate installed on consumer machine’s personal store of the user who wants to consume the services. The *.cer file will be installed on Server “Trusted Root Certification Authorities” under local machine.
4.) Setup the web site for SSL as follows:· Go to website properties
Go to Directory Security
Under the “Secure Communication”, go to “Server Certificate”: Use the Server Certificate wizard to import the server certificate created in step2. Use the port available e.g. 8002 on the IIS server and configured with DNS name entry.
Come back to Directory Security tab
Client on “Edit” just under “View Certificate”
Enable “Require Secure Channel (SSL) option” and “Require 128-bit encryption”. Under Client Certificate option on same page, select “Require Client Certificate”.
Set the Website authentication to “Basic Authentication” as follows:·
Go to web site properties
Go to Directory Security
Under the “Authentication and access control” group, click on Edit·
Uncheck “Enable Anonymous access” option 1 Check only “Basic Authentication” option, rest all must be unchecked.
In “Default domain” text box type, the domain.
5.) Once Server configuration is completed, the site can be accessed using https:
Note: In order to configure SSL for multiple sites on same IIS server, you would need a separate server certificate and hence DNS entries are required so that each website on same server is uniquely identified and certificate can be created such that it is unqique to the web site we need it for. Also you need separate SSL port i.e. already used SSL port can not be used to configure another site with same SSL port.