Posts

Showing posts from September, 2010

Configuring Sharepoint Sever 2007

Working on configuring sharepoint server 2007 in windows server 2003. Having issue in connecting a separate DB server with sharepoint server using domain admin account. Does anyone have idea, how to do it?

Handling Exit Event of Console Application in C#

Do you wan to do something on the exit event of Console Application. .Net framework does not provide such direct event to do that. You can use following workaround to have that kind of event in your application.


        [STAThread]
        static void Main(string[] args)
        {
            HandlerRoutine hr = new HandlerRoutine(Handler);
            SetConsoleCtrlHandler(hr, true);
            GC.KeepAlive(hr); 

        }

        public static void DoOnAppExit()
        {
                  //Do something......
        }

        #region Handle App Exit

        static Boolean Handler(CtrlTypes CtrlType)
        {
            // A switch to handle the event type.
            switch (CtrlType)
            {
                case CtrlTypes.CTRL_C_EVENT:
                case CtrlTypes.CTRL_BREAK_EVENT:
                case CtrlTypes.CTRL_CLOSE_EVENT:
                case CtrlTypes.CTRL_LOGOFF_EVENT:
                case CtrlTypes.CTRL_SHUTDOWN_EVENT:
                    DoOnAppExit();
  …

My Web in limeweb

I deployed my new web site in limeweb. It is free and easy to use. http://thilanka.limewebs.com/

WCF Client with HTTPS enabled and Authentication

Following code sample shows how WCF client can be used with WCF service running on HTTPS and secure with authentication.

        // Create the binding.
        WSHttpBinding myBinding = new WSHttpBinding();
        myBinding.Security.Mode = SecurityMode.Transport;
        myBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;

        // Create the endpoint address.
        EndpointAddress ea = new  EndpointAddress("https://www.mywcfservice.com/testwcf.svc");

        // Create the client.
        TestServiceClient cc =   new TestServiceClient(myBinding, ea);
        // The client must provide a user name and password.
        cc.ClientCredentials.UserName.UserName = "uname";
        cc.ClientCredentials.UserName.Password = "pwd";
        try
        {
            // Begin using the client.
            cc.Open();

            cc.DoSomething();

            // Close the client.
            cc.Close();
        }
        catch (Exc…

Cannot see None English characters (ANSI Encoded) in .Net controls when loading form files

Do you have problems with showing non English characters in .net controls ? If you have seen non English characters are shown as "?" in .Net controls when you load contents from files. That is because of the encoding issue. You have use "Encoding.Default" to solve this issue when you read from file.

File.ReadAllLines(filename,Encoding.Default)

javasripts in ActiveX doesn't work properly in IE8

Recently I experienced with that, some javascripts in ActiveX are blocked in IE8 which were working in IE6 and IE7. Once I added the domain to trusted site in IE8, those scripts are working as earlier. If you have same issue, please go to Tools > Option > Security > trusted sites and add the domain you want. Then refresh the browser. That's it. I think this will help some one having issues with ActiveX in IE8.