Links for VSX development

by plykkegaard 1. August 2014 21:52

Tags: , , ,

C# | VS 2012 | VSX

Various tools for Sencha Touch development

by plykkegaard 28. June 2014 16:48

Tools for html5 and mobile development

Tags: , ,

VS 2013 | Sencha Touch | Opera

BizTalk Map Viewer

by plykkegaard 23. March 2014 08:32

By pure luck I stumpled across BizTalk Map Viewer while searching for some WCF stuff. Map Viewer is a graphical interface for the BizTalk Map Documenter

While we are at it, there's a fix for Map Documenter when using it with latest versions of BizTalk (2010 and forward)

Have fun  /Peter

Tags:

BizTalk | Mapping

Testing BizTalk Http Receive Adapter and streaming files

by plykkegaard 1. March 2014 08:53

A simpel test

There is quite a few steps involved in setting up a receive port/location for the http receive adapter on the server side, firewall and client side

It is nice to have a toolbox to test the connectivity 

The following files should be stored in the root folder of the website added as the public address configured in the http transport properties dialog box

default.htm

After configuration in IIS and BizTalk access can be checked using a very simple html page, it could be index.htm or default.htm by preference

<html>
	<head>
		<title>BizTalk Service - HTTP Receive</title>
	</head> 
	<body> 
		<p>BizTalk Service - HTTP Receive</p> 
		<p><a href="form.htm">Connectivity test</a></p>
	</body> 
</html>
This page is used to test the firewall settings and https connectivity and whether the client certificate is properly installed on the client server

form.htm

On the page I have a link to a basic html form also to test BizTalk Server and IIS configuration. In BizTalk you should receive a basic document with content taking from the imput fields

<html> 
	<head>
		<title>BizTalk Service - HTTP Receive</title>
	</head> 
	<body> 
		<form name="Test" method="post" action="BTSHTTPReceive.dll"> 
			<p>Test BTSHTTPReceive port, please type a short message:</p> 
			<p>
				<input type="text" name="message"> 
				<input type="submit" value="Submit"> </p>
			<p>You will receive a response with an correlationtoken if the post is successfull</p>
		</form> 
	</body> 
</html>

Very basic and will send the data "message=<value>" to BizTalk and return a correlation token if confgured

Scale-up

Next step is to test the complete flow, I have created a small console application as an example on how to send data files to BizTalk through the Http Receive Adapter

WebClient

I will use the WebClient class for sending the data
First we need to create a sub class to add a X.509 certificate to HttpWebRequest ClientCertificates collection

class HttpsClient : WebClient
{
	public X509Certificate2 Certificate { get; set; }
	
	// Override GetWebRequest to add certificate to the request object
	protected override WebRequest GetWebRequest(Uri address)
	{
		HttpWebRequest request = (HttpWebRequest)base.GetWebRequest(address);
		request.ClientCertificates.Add(this.Certificate);
		return request;
	}
}

Get Certificate

The certificate is retrieved from current user/address book certificate store using the thumbprint, the method is part of the console main program class

static X509Certificate2 GetClientCertificateFromThumbPrint(string thumbPrint)
{
	if (string.IsNullOrEmpty(thumbPrint))
		throw new ArgumentException(
			String.Format("Error: Thumbprint is empty"), "ThumbPrint"
		);
	
	X509Store _store = new X509Store(
		StoreName.AddressBook, StoreLocation.CurrentUser
		);
	
	// Try to open the store.
	_store.Open(OpenFlags.ReadOnly);
	// Find the certificate that matches the thumbprint.
	X509Certificate2Collection _certs = _store.Certificates.Find(
		X509FindType.FindByThumbprint, thumbPrint, false
		);
	_store.Close();
	
	// Check to see if our certificate was added to the collection. 
	// If no, throw an error, if yes, create a certificate using it.
	if (_certs.Count == 0)
	{
		throw new ArgumentException(
			String.Format(
				"Error: No certificate found containing thumbprint: {0}", 
				thumbPrint
				), 
			"ThumbPrint"
			);
	}
	return _certs[0];
}

Main program

Code listing for the main program, get client certificate, open stram for sending data to the site and open another stream to the local file, use the copyto method and flush the stream to send the data across the boundaries

// Main program
static void Main(string[] args)
{
	byte[] _responseHeaders = null;
	string _clientResponse = string.Empty;


	X509Certificate2 _certificate = null;
	try
	{
		string _thumbPrint = "1a 2b 3c 4d 5e 6f a1 b2 c3 d4 e5 f6 1a 2b 3c 4d 5e 6f a1 b2";
		_certificate = GetClientCertificateFromThumbPrint(_thumbPrint);
	}
	catch (Exception exc)
	{
		Console.WriteLine(exc);
		throw new Exception("Certificate exception", exc);
	}

	// Url to BizTalk Http Receive ISAPI dll
	Uri _address = new Uri("https://biztalk.test.invalid/test/BTSHTTPReceive.dll");
	// Load file from disk or other source
	string _filePath = @"d:\data\test\Order.4b496d3c-6214-495b-bbce-1850516b6cf9.xml";

	try
	{
		using (HttpsClient _client = new HttpsClient())
		{
			_client.Certificate = _certificate;
			using (var _stream = _client.OpenWrite(_address))
			{
				using (FileStream _fileStream = 
					new FileStream(_filePath, FileMode.Open, FileAccess.Read))
				{
					_fileStream.CopyTo(_stream);
				}
				_stream.Flush();
			}

			Console.WriteLine("{0} at {1:F}", _client.StatusCodeDescription, _client.LastModified);
			Console.WriteLine("");

			_responseHeaders = _client.ResponseHeaders.ToByteArray();
			_clientResponse = _client.Response;

		}
	}
	catch (WebException exc)
	{
		Console.WriteLine(exc);
		throw new Exception("WebClient exception", exc);
	}

	finally
	{
		if (!string.IsNullOrEmpty(_clientResponse))
			Console.WriteLine(_clientResponse);

		if (_responseHeaders != null && _responseHeaders.Length > 0)
			// Decode and display the response.
			Console.WriteLine(Encoding.ASCII.GetString(_responseHeaders));
	}
}

Server Response

This is working ok but we are missing the correlation token received and status codes from the web server. From the content-length in the ReponseHeader we can see that we have the data

GetWebResponse

Override the GetWebResponse method in the WebClient class to read the reponse from WebRequest class as well as status code and description

// Intercept the WebRequest object to get response data from host
protected override WebResponse GetWebResponse(WebRequest request)
{
	this.StatusCode = HttpStatusCode.Accepted;
	
	// Get response stream from web request
	HttpWebResponse _webResponse = (HttpWebResponse)request.GetResponse();
	
	this.StatusCode = _webResponse.StatusCode;
	this.StatusCodeDescription = _webResponse.StatusDescription;
	this.LastModified = _webResponse.LastModified;
	
	// Is the stream readable?
	if (this.StatusCode == HttpStatusCode.Accepted && _webResponse.GetResponseStream().CanRead)
	{
		using (StreamReader _reader = new StreamReader(_webResponse.GetResponseStream(), true))
		{
		  // Get stream content
		  this.Response = _reader.ReadToEnd();
		}
	}
	return base.GetWebResponse(request);
}

Remember to add the four extra properties to our HttpsClient class and you can read the properties after the OpenWrite operation is finished and the Stream has been closed

Sample VS 2012 project attached to article  /have fun

BtsHttpReceiveTest.zip (35,83 kb)

Tags: ,

BizTalk | BizTalk 2006 | C# | Certificates | WCF

Create Ext.NET CRUD in code behind

by plykkegaard 27. May 2012 12:23

A slightly more comples example with command button to insert, edit and delete rows, taken from Gridpanel -> Saving Variations -> Httphandler

The NorthwindDataContext and other needed classes can be fetched from the download section at Ext.NET: http://www.ext.net/download/
Add a new project (Ext.Net.Examples) to your solution and add the classes you need to the project. Northwind and SerializableEntity can be found in the Code folder

I have created some functions to illustrate how the code can be organized when working in code behind. Columns and type of editor to use should be stored in configuration files or a tables but for this example everything is fixed/hardcoded values

Problem with generic handler

There is a minor problem with generic handler: SuppliersSave
Find this code

StoreResponseData sr = new StoreResponseData()

And replace with this

// We need to intialize the StoreResponseData otherwise an exception is thrown
StoreResponseData sr = new StoreResponseData()
{
    Data = JSON.Serialize(string.Empty),
    Message = string.Empty,
    Success = true,
    Total = 0
};

NorthwindDataContext

Also please note that the notwinddatacontext classes has joins between tables and as a consequence a lot of tables is loaded when quering the suppliers table from linq
I deleted the joins in order to test the code below but a less drastic approach is proabably the better 

Code

default.aspx

<%@ Page Language="C#" 
    AutoEventWireup="true" 
    CodeBehind="default.aspx.cs" 
    Inherits="dk.looksharp.crud._default" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html />

<html>
<head id="head" runat="server">
    <title>The CRUD Example</title>
    <link href="/resources/css/site.css" rel="stylesheet" type="text/css" />    
</head>
<body>
    <ext:ResourceManager runat="server" />
    
</body>
</html>

default.aspx.cs

using System;
using System.Web.UI.WebControls;
using System.Configuration;

using ext = Ext.Net;

namespace dk.looksharp.crud
{
    public partial class _default : System.Web.UI.Page
    {

        protected ext.Column BuildColumn(string dataIndex, string columnLabel)
        {
            return BuildColumn(dataIndex, columnLabel, 0);
        }

        protected ext.Column BuildColumn(string dataIndex, string columnLabel, int flex)
        {
            return new ext.Column
            {
                ID = string.Format("col{0}", dataIndex),
                DataIndex = dataIndex,
                Text = columnLabel,
                Flex = flex,
                Editor =
                {
                    new ext.TextField()
                    {
                        ID = string.Format("txt{0}", dataIndex),
                    }
                }
            };
        }

        protected ext.Model BuildModel()
        {
            return new ext.Model()
            {
                ID = "model",
                IDProperty = "SupplierID",
                Fields = 
                {
                    new ext.ModelField("SupplierID"),
                    new ext.ModelField("CompanyName"),
                    new ext.ModelField("ContactName"),
                    new ext.ModelField("ContactTitle"),
                    new ext.ModelField("Address"),
                    new ext.ModelField("City"),
                    new ext.ModelField("Region"),
                    new ext.ModelField("PostalCode"),
                    new ext.ModelField("Country"),
                    new ext.ModelField("Phone"),
                    new ext.ModelField("Fax")
                }
            };
        }

        protected ext.Store BuildStore()
        {
            return new ext.Store()
            {
                ID = "store",
                Proxy =
                {
                    new  ext.AjaxProxy()
                    {
                        Url = "SuppliersSave.ashx",
                        Reader = {
                            new ext.JsonReader()
                            {
                                Root="data",
                                SuccessProperty = "success", 
                                MessageProperty = "message"
                            }
                        },
                        Writer = 
                        {
                            new ext.JsonWriter()
                            {
                                Encode = true, 
                                Root="data"
                            }
                        }
                    }
                },         
                SyncParameters = 
                {
                    new ext.StoreParameter()
                    {
                        Name = "action" ,
                        Value = "operation.action",
                        Mode = ext.ParameterMode.Raw
                    }
                },
                Model =
                {
                    BuildModel()
                },
                Sorters =
                {
                    new ext.DataSorter()
                    {
                        Property = "CompanyName",
                        Direction = ext.SortDirection.ASC
                    }
                },
                Listeners =
                {
                    Write =
                    {
                        Handler = "Ext.Msg.alert('Success', 'The suppliers have been saved');"
                    }
                }
            };
        }

        protected ext.Panel BuildTopPanel()
        {
            return new ext.Panel()
            {

                ID = "panel", 
                Region = ext.Region.North,
                Border = false,
                Height = 120,
                BodyPadding = 6,
                        
                Html = "<h1>CRUD Grid Example</h1>" +
                    "<p>Demonstrates how to get data from HttpHandler and save using HttpHandler.</p>"
            };
        }

        protected ext.GridPanel BuildCrudPanel()
        {
            return new ext.GridPanel()
            {
                ID = "gridPanel",
                Region = ext.Region.Center,
                Title = "Suppliers",
                Icon = ext.Icon.Lorry,
                Frame = true,
                Store =  
                {
                    this.BuildStore()
                },
                ColumnModel =
                {
                    Columns = 
                    {
                        BuildColumn("CompanyName", "Company Name", 1), 
                        BuildColumn("ContactName", "Contact Name"),
                        BuildColumn("ContactTitle", "Contact Title"),
                        BuildColumn("Address", "Address"),
                        BuildColumn("City", "City"),
                        BuildColumn("Region", "Region"),
                        BuildColumn("PostalCode", "Postal Code"),
                        BuildColumn("Country", "Country"),
                        BuildColumn("Phone", "Phone"),
                        BuildColumn("Fax", "Fax")
                    }
                },
                SelectionModel = 
                {
                    new ext.RowSelectionModel()
                    {
                        ID = "rowSelectionModel", 
                        Mode = ext.SelectionMode.Multi,
                        Listeners = 
                        {
                            Select = 
                            {
                                Handler = "#{btnDelete}.enable();"
                            },
                            Deselect =
                            {   
                                Handler = "if (!#{gridPanel}.selModel.hasSelection()) {#{btnDelete}.disable();}"
                            }
                        }
                    }
                },
                Plugins =
                {
                    new ext.CellEditing()
                    {
                        ID = "cellEditing" 
                    }
                },
                Buttons = 
                {
                    new ext.Button()
                    {
                        ID = "btnAdd",
                        Text = "Insert",
                        Icon = ext.Icon.Add,
                        Listeners =
                        {
                            Click =
                            {
                                Handler = "#{store}.insert(0, {}); #{gridPanel}.editingPlugin.startEditByPosition({row:0, column:0});"
                            }
                        }
                    },
                    new ext.Button()
                    {
                        ID = "btnDelete",
                        Text = "Delete",
                        Icon = ext.Icon.Delete,
                        Disabled = true,
                        Listeners =
                        {
                            Click = 
                            {
                                Handler="#{gridPanel}.deleteSelected();if (!#{gridPanel}.hasSelection()) {#{btnDelete}.disable();}"
                            }
                        }
                    },
                    new ext.Button()
                    {
                        ID = "btnSave", 
                        Text = "Save",
                        Icon = ext.Icon.Disk,
                        Listeners =
                        {
                            Click =
                            {
                                Handler = "#{store}.sync();"
                            }
                        }
                    },
                    new ext.Button()
                    {
                        ID ="btnCancel",
                        Text = "Clear",
                        Icon = ext.Icon.Cancel,
                        Listeners = 
                        {
                            Click = 
                            {
                                Handler = "#{gridPanel}.getSelectionModel().deselectAll();;if (!#{gridPanel}.hasSelection()) {#{btnDelete}.disable();}"
                            }
                        }
                    },
                    new ext.Button()
                    {
                        ID = "btnRefresh",
                        Text = "Refresh",
                        Icon = ext.Icon.ArrowRefresh,
                        Listeners =
                        {
                            Click = 
                            {
                                Handler="#{store}.load();"
                            }
                        }
                    }
                }
            };
        }


        protected void Page_Load(object sender, EventArgs e)
        {

            this.Page.Controls.Add
            (
                new ext.Viewport()
                {
                    Layout = "BorderLayout",
                    Items = 
                    {
                        BuildTopPanel(),
                        BuildCrudPanel()
                    }
                }
            );
        }
    }
}

Tags: , , ,

Articles | ASP.NET | Ext.NET

Create Ext.NET GridPanel in codebehind

by plykkegaard 13. May 2012 12:16

Quite a few requests in the Ext.NET community forums is on how to use the framework in codebehind

I have thrown together a small example based on the example GridPanel -> DataSource Controls -> SqlDataSource using the employee table in the Microsoft Northwind example database to feed the content

The c# code is taken almost directly from the markup coding in the example above

(NB! the code is tested using Ext.NET 2.0 Beta 1)

default.aspx

<%@ Page Language="C#" AutoEventWireup="true" 
    CodeBehind="default.aspx.cs" 
    Inherits="dk.looksharp.dbview._default" %>
<%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>

<!DOCTYPE html PUBLIC 
    "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="head" runat="server">
    <title>GridPanel</title>

    <style type="text/css">
    <style type="text/css">
        .x-grid-cell-fullName .x-grid-cell-inner {
            font-family : tahoma, verdana;
            display     : block;
            font-weight : normal;
            font-style  : normal;
            color       : #385F95;
            white-space : normal;
        }
        
        .x-grid-rowbody div {
            margin : 2px 5px 20px 5px !important;
            width  : 99%;
            color  : Gray;
        }
        
        .x-grid-row-expanded td.x-grid-cell{
            border-bottom-width:0px;
        }
    </style>

</head>
<body>
    <form id="form" runat="server">
        <ext:ResourceManager id="resourceManager" runat="server" Theme="Gray" />
    </form>
</body>
</html>

 

default.aspx.cs

using System;
using System.Web.UI.WebControls;
using System.Configuration;

using ext = Ext.Net;

namespace dk.looksharp.dbview
{
    public partial class _default : System.Web.UI.Page
    {

        string _dataSourceId = "SqlDataSource";
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            this.form.Controls.Add(BuildDataSource());
            this.form.Controls.Add(BuildGridPanel());
        }

        private SqlDataSource BuildDataSource()
        {
            string _selectStatement = 
                "SELECT " +
                    "[EmployeeID],  " +
                    "[LastName],  " +
                    "[FirstName],  " +
                    "[Title],  " +
                    "[TitleOfCourtesy],  " +
                    "[BirthDate],  " +
                    "[HireDate],  " +
                    "[Address],  " +
                    "[City],  " +
                    "[Region],  " +
                    "[PostalCode],  " +
                    "[Country],  " +
                    "[HomePhone],  " +
                    "[Extension],  " +
                    "[Notes]  " +   
                "FROM [Employees]";

            return new SqlDataSource
            {
                ID = _dataSourceId,
                ConnectionString = ConfigurationManager.ConnectionStrings["Northwind"].ToString(),
                SelectCommand = _selectStatement

            };
        }

        private ext.GridPanel BuildGridPanel()
        {
            return new ext.GridPanel
            {
                Border = true,
                Store =  
                {
                    this.BuildStore()
                },
                SelectionModel = 
                { 
                    new ext.RowSelectionModel() { Mode = ext.SelectionMode.Single }
                },
                ColumnModel =
                {
                    Columns =
                    {
                        new ext.Column 
                        {
                            ID="fullName", 
                            Text="Full Name",
                            Width=150,
                            DataIndex="LastName"
                            // <Renderer Fn="fullName
                        },

                        new ext.Column 
                        {
                            DataIndex="Title",
                            Text="Title",
                            Width=150
                        },
                        new ext.Column 
                        {
                            DataIndex="TitleOfCourtesy",
                            Text="Title Of Courtesy",
                            Width=150
                        },
                        new ext.Column 
                        {
                            DataIndex="BirthDate",
                            Text="BirthDate",
                            Width=110
                        },
                        new ext.Column 
                        {
                            DataIndex="HireDate",
                            Text="HireDate",
                            Width=110
                        },
                        new ext.Column 
                        {
                            DataIndex="Address",
                            Text="Address",
                            Width=150
                        },
                        new ext.Column 
                        {
                            DataIndex="City",
                            Text="City",
                            Width=100
                        },
                        new ext.Column 
                        {
                            DataIndex="Region",
                            Text="Region",
                            Width=100
                        },
                        new ext.Column 
                        {
                            DataIndex="PostalCode",
                            Text="PostalCode",
                            Width=100
                        },
                        new ext.Column 
                        {
                            DataIndex="Country",
                            Text="Country",
                            Width=100
                        },
                        new ext.Column 
                        {
                            DataIndex="HomePhone",
                            Text="HomePhone",
                            Width=150
                        },
                        new ext.Column 
                        {
                            DataIndex="Extension",
                            Text="Extension",
                            Width=100
                        }
                    }
                },
                View =
                {
                   new ext.GridView()
                   {
                        StripeRows = true,
                        TrackOver = true 
                   }
                }
            };
        }

        private ext.Store BuildStore()
        {
            ext.Store store = new ext.Store
            {
                ID = "store", // <-- ID is Required
                Model = 
                { 
                    new ext.Model 
                    {
                        Fields = 
                        {
                            new ext.ModelField("FirstName"),
                            new ext.ModelField("LastName"),
                            new ext.ModelField("Title"),
                            new ext.ModelField("TitleOfCourtesy"),
                            new ext.ModelField("BirthDate", ext.ModelFieldType.Date, "M/d hh:mmtt"),
                            new ext.ModelField("HireDate", ext.ModelFieldType.Date, "M/d hh:mmtt"),
                            new ext.ModelField("Address"),
                            new ext.ModelField("City"),
                            new ext.ModelField("Region"),
                            new ext.ModelField("PostalCode"),
                            new ext.ModelField("Country"),
                            new ext.ModelField("HomePhone"),
                            new ext.ModelField("Extension"),
                            new ext.ModelField("Notes"),
                            new ext.ModelField("company")
                        }
                    }
                }
            };

            store.DataSourceID = this._dataSourceId;
            //store.DataBind();

            return store;
        }
    }
}

Tags: , , ,

ASP.NET | Ext.NET

Create Ext.NET objects in codebehind

by plykkegaard 30. April 2012 19:50

For the last couple of years I have been using Ext.NET for intranet applications used by our team. The oldest application is a tableeditor in which we can quickly edit customization parameters for our integration solution based on Biztalk 2006 R2

In this article I will present a small example on how to work with Ext.NET in codebehind and this will also be the foundation for future articles where I will end up with a full blown table editor

I will use Visual Studio 2010, .NET Framework 4.x and Ext.NET 2.0 Beta. Data/content is stored on SQL Server 2005 

Use nuget in VS to download Ext.NET and related components, You also need to install MVC even if you do not intend to use it as Ext.NET uses some of the classes from MVC (no known workaround)

The code below is a tranformed version taken from the demo pages at Ext.NET
Direct link: http://examples.ext.net/#/Portal/Basic/Simple/

Documentation from an older version of Ext.NET can be found here: http://docs.ext.net/ 

(NB! the code is tested on Ext.NET 2.0 Beta 1)

In case you need a C# to VB conversions please use eg
http://www.developerfusion.com/tools/convert/csharp-to-vb/  

the page with markup (default.aspx)

<%@ Page Language="C#" AutoEventWireup="true" 
    CodeBehind="default.aspx.cs" 
    Inherits="dk.looksharp.dbview._default" %>
<%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>

<!DOCTYPE html PUBLIC 
    "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="head" runat="server">
    <title>Portal</title>
</head>
<body>
    <form id="form" runat="server">
        <ext:ResourceManager id="resourceManager" runat="server" Theme="Gray" />
    </form>
</body>
</html>

 

Codebehind (default.aspx.cs)

using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using ext = Ext.Net;
using ux = Ext.Net.Utilities;

namespace dk.looksharp.dbview
{
    public partial class _default : System.Web.UI.Page
    {
        private int _portletId = 1;

        protected override void OnInit(EventArgs e)
        {
            // Viewport
            ext.Viewport _viewport = new ext.Viewport
            {
                Layout = "BorderLayout",
                StyleSpec = "backgroundColor: transparent;",
                Items = 
                { 
                    CreateAccordion(),
                    CreateTabPanel()
                }
            };
            this.form.Controls.Add(_viewport);
            base.OnInit(e);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!ext.X.IsAjaxRequest)
            {
                // Load portlet content
string text = @"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed metus nibh, sodales a, porta at, vulputate eget, dui. Pellentesque ut nisl. Maecenas tortor turpis, interdum non, sodales non, iaculis ac, lacus. Vestibulum auctor, tortor quis iaculis malesuada, libero lectus bibendum purus, sit amet tincidunt quam turpis vel lacus. In pellentesque nisl non sem. Suspendisse nunc sem, pretium eget, cursus a, fringilla vel, urna."; this.resourceManager.RegisterClientScriptBlock("text", string.Format("var text=\"{0}\";", text)); foreach (ext.Portlet portlet in ux.ControlUtils.FindControls<ext.Portlet>(this.Page)) { portlet.Html = "={text}"; portlet.BodyPadding = 5; portlet.CloseAction = ext.CloseAction.Hide; } } } private ext.Panel CreateAccordion() { // Accordion / West Region ext.Panel _accordion = new ext.Panel { Region = ext.Region.West, Title = "West", Width = Unit.Pixel(200), Layout = ext.LayoutType.Accordion.ToString(), MinWidth = 175, MaxWidth = 400, Split = true, Margins = new ext.Margins(5, 0, 5, 5).ToString(), Collapsible = true, Items = { new ext.Panel { Title = "Navigation", BodyBorder = 0, BodyStyle = "padding:6px;", Icon = ext.Icon.FolderGo, Html = "={text}" }, new ext.Panel { Title = "Settings", BodyBorder = 0, BodyStyle = "padding:6px;", Icon = ext.Icon.FolderWrench, Html = "={text}" } } }; return _accordion; } private ext.TabPanel CreateTabPanel() { ext.TabPanel _panel = new ext.TabPanel { Title = "Tab Panel", ActiveTabIndex = 0, Region = ext.Region.Center, Margins = new ext.Margins(5, 2, 5, 0).ToString(), Items = { CreatePortalPanel("Tab 1"), CreatePortalPanel("Tab 2") } }; return _panel; } private ext.Panel CreatePortalPanel(string title) { ext.Portal _portal = new ext.Portal { Border = false }; ext.PortalColumn _column = null; for (int i = 0; i < 3; i++) { _portletId++; ext.Portlet _portlet = new ext.Portlet { ID = string.Format("Portlet{0}", _portletId), Title = string.Format("Panel {0}", _portletId), Icon = ext.Icon.Accept }; _column = new ext.PortalColumn { CellCls = "x-column-padding", Items = { _portlet } }; _portal.Items.Add(_column); } ext.Panel _panel = new ext.Panel { Title = title, Layout = ext.LayoutType.Fit.ToString(), Items = { _portal } }; return _panel; } } }

Tags: , , ,

Articles | ASP.NET | Ext.NET

Certificate blues

by plykkegaard 22. February 2011 21:56

Overview

Currently I am trying to figure out how we can implement the OIOSI/RASP Framework (OIO Service oriented Infrastructure/Reliable Asynchronous Secure Profile)

The framework supports reliable, secure E-Business using open standards. Including components for web service calls, non-repudiation, UDDI-registries and a standardized subset of the UBL 2.0 business document profile. Supported for .Net and java.

Among other things I need to install various certificates for use with services such as eg IIS to handle encrypted messages and this have given me some headaches as I haven't used them much until now
Obviously the documentation is takes the wrong path and not very well written, haven't we seen that one before once or twice

Googling around gave me some pieces of advice but not the full picture, by pure luck I found a topic at stackoverflow.com and some comments by Ċ½eljko Tanovic and I managed to solve but also understand the problem

The problem

I had two errors "key does not exist" because IIS couldn't find the private key file and "invalid handle" caused by missing user privileges

First mistake being misled by the documentation was to install in the personal store and move the certificate to the localmachine store, the private key was installed in the current user folder and inaccessible by the IIS service accounts
Second was missing user privileges and straight forward to fix as soon as the first problem was solved

While troubleshooting you can use FindPrivateKey to get current location of the private key file. FindPrivateKey is part of the Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4

You can add root LocalMachine -t "db e0 d9 a8 1f 2c a2 ed 05 c7 55 81 64 68 a6 72 fb 44 e4 0a" to the debug project property tab and the console in the debugger to the path you need
Please note, the documentation gives you also an extra -c at the end, but this additional parameter causes an if statement to fail and nothing is found

Folder for private keys when the ceritificate is imported in the personal store
C:\Documents and Settings\<user>\Application Data\Microsoft\Crypto\RSA

Folder for private keys when the ceritificate is imported to localmachine store
C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys

Solution: Import certificates

Steps when importing certificates which is used by services such as eg IIS

  • Import certificate to the localmachine store (root / Trusted Root Certificate Authorities)
  • Check that the private key file is stored in the MachineKeys folder by using the FindPrivateKey tool
  • Set apprioprate user privileges for your service accounts, eg ASPNET and user account running the Application Pool

Problem solved - Well at least I can see my webservice page in IE Cool

Update! Instead of all the hazzle setting the access rights manually you can also use the Windows HTTP Services Certificate Configuration Tool (WinHttpCertCfg.exe)
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=19801

Command line:

C:\Program Files (x86)\Windows Resource Kits\Tools>winhttpcertcfg 
             -g -c LOCAL_MACHINE\My -s MyWebSite -a DefaultAppPool

Tags: , , ,

Certificates | OIOSI | RASP

VMware Player - Virtual Network Editor

by plykkegaard 2. January 2011 19:55

The Virtual Network Editor (vmnetcfg.exe) is not extracted during the installation and it is really needed if you want to mess around with the virtual network settings on the host OS.
It is a problem if you have different network adapters installed, like eg Bluetooth, WiFi, Hamachi etc

Extract cab files

You can extract all files from the installation by using the option /e and a destination folder is supplied

C:\Download\vmware>VMware-player-3.1.3-324285.exe /e .\extract

Change to the subfolder and find the file network.cab, open it in eg Izarch and extract vmnetcfg.exe to the vmware player installation folder. You can also create a shortcut in your list of program files if needed

Tags: ,

VMware

Expand your vmware disks

by plykkegaard 25. December 2010 14:55

I have used VMware Workstation and - Viewer for testing, development, deployment and maintenance during quite a few years. Great product for this.

From time to time I have been in need of expanding the disks on the virtual machine as they have been almost out of free space. With VMware it's quite easy to do using the free standalone Converter.

With VMware vCenter Converter you can take copies of your virtual machine and change the disksize during the process.

There's a few steps where you need to pay attention otherwise the process is straight forward

  • Select source
  • Let the converter read the configuration
  • Choose destination
  • And alter the options a little ...

The converter suggest "Copy all disks and maintain layout", change this to "Select volumes to copy" and you can set new disksize for each disk.

Type the new disksize in GB and watch while the converter does the all the hard work or go and grab a cop of coffee while you're waiting

Tags: ,

VMware

License

All work downloaded from this site are licensed under the GNU AGPLv3 License

Calendar

<<  May 2016  >>
MoTuWeThFrSaSu
2526272829301
2345678
9101112131415
16171819202122
23242526272829
303112345

View posts in large calendar

About me

I am yet another .NET developer (C#), experienced in various integration projects
  • Datacollection in the warehouse using pick by voice (VoCollect) or rf scanners (Psion Teklogix)
  • Electronic data exchange using Biztalk 2006 R2
Other cool stuff I have worked with in the past and present and will be working with in future

RecentPosts

RecentComments

None

Tracking