Welcome to MSDN Blogs Sign in | Join | Help

Internet Explorer Developer Toolbar

The Microsoft Internet Explorer Developer Toolbar provides a variety of tools for quickly creating, understanding, and troubleshooting Web pages.

http://www.microsoft.com/downloads/details.aspx?familyid=e59c3964-672d-4511-bb3e-2d5e1db91038&displaylang=en

Posted by Prakash | 1 Comments

Microsoft ASP.NET 3.5 Extensions Preview

The ASP.NET 3.5 Extensions Preview is a new release that provides new functionality being added to ASP.NET 3.5 and ADO.NET in 2008. This release delivers a set of new features that target:

  1. Enabling High Productivity Data Scenarios - including MVC, Entity Framework, ADO.NET Data Services and dynamic data
  2. Supporting Test Driven Development - including a powerful and extensible MVC framework
  3. Creating the best server for Rich Clients - including Ajax history support and Silverlight controls for ASP.NET readmore
Posted by Prakash | 1 Comments
Filed under:

How to check whether the assembly in debug mode

Assembly assembly = Assembly.LoadFile(@"D:\WCF\WindowsFormsApplication3\WindowsFormsApplication3\bin\Debug\WindowsFormsApplication3.exe");

object[] attributes = assembly.GetCustomAttributes(typeof(System.Diagnostics.DebuggableAttribute), true);

if ((attributes != null ) && (attributes.Length > 0))

{

MessageBox.Show("Debug mode:");

}

 

Posted by Prakash | 1 Comments

How to add work item programmatically

using System;

using System.Collections;

using System.Xml;

using System.Collections.Generic;

using System.Text;

using Microsoft.TeamFoundation.Client;

using Microsoft.TeamFoundation.WorkItemTracking.Client;

 

class LogBugs

    {

        Project proj = null;

        public LogBugs()

        {

           

            string serverName = "<<ServerIPAddress>>";

            string projectName = "<<ProjectName>>";

 

            Console.WriteLine("Connecting to {0}...", serverName);

// Popup the authentication dialog

            TeamFoundationServer tfs = new TeamFoundationServer(serverName, new UICredentialsProvider());

            tfs.EnsureAuthenticated();

 

 

 

            WorkItemStore store = (WorkItemStore)tfs.GetService(typeof(WorkItemStore));

            proj = store.Projects[projectName];

 

        }

        /// <summary>

        /// Adds a new work item to the Team System project

        /// </summary>

        public  string AddNewWorkItem(string type, string title, string desc, string source, string severity, string bugType, string rootCauseCategory, string rootCauseAnalysis)

        {

            WorkItemType wit = proj.WorkItemTypes[type];

            WorkItem wi = new WorkItem(wit);

 

            wi.Title = title;

            wi.Description = desc;

 

            wi["Assigned To"] = "<<Assigned To>>";

            wi["Severity (G)"] = severity;

            wi["Bug Type (G)"] = bugType;

            wi["Root Cause (G)"] = rootCauseCategory;

            wi["Root Cause Analysis (G)"] = rootCauseAnalysis;

            wi["Source (G)"] = "<<Source>>";

 

            wi.AreaPath = "<<Area Path>>";

            wi.IterationPath = @"<<IterationPath>>";

 

 

            if (!ValidityCheck(wi))

            {

                Console.WriteLine("Unable to save, Invalid Fields");

                return "0";

            }

            else

            {

              wi.Save();

                Console.WriteLine("Successfully saved the workitem");

 

                return wi.Id.ToString();

            }

        }

 

        /// <summary>

        /// Validates the field before saving.

        /// </summary>

        private static bool ValidityCheck(WorkItem wi)

        {

            ArrayList invalidFields = wi.Validate();

 

            if (invalidFields.Count == 0)

            {

                return true;

            }

            else

            {

                foreach (Field f in invalidFields)

                {

 

                    Console.WriteLine("Invalid Field Found '{0}': {1}", f.Name, f.Status.ToString());

                    Console.WriteLine("Current Value: '{0}'", f.Value);

                    Console.WriteLine();

                }

                return false;

            }

        }

 

    

    }

Posted by Prakash | 1 Comments

How to detect which control caused postback

public static Control GetPostBackControl(Page page)
    {
        Control control = null;
        string ctrlname = page.Request.Params.Get("__EVENTTARGET");
        if (ctrlname != null && ctrlname != string.Empty)
        {
            control = page.FindControl(ctrlname);
        }
        else
        {
            foreach (string ctl in page.Request.Form)
            {
               if ((ctl.LastIndexOf(".x") > 0) || (ctl.LastIndexOf(".y") > 0))
                {
                    control = page.FindControl(ctl.Substring(0, ctl.Length - 2));
                    break;
                }
                control = page.FindControl(ctl); 
                if ((control is System.Web.UI.WebControls.Button))
                {
                    break;
                }
             }
          }
        return control;
        }

Posted by Prakash | 1 Comments

How do I detect a session has expired and redirect it to another page

override protected void OnInit(EventArgs e)
  {
       base.OnInit(e);
if (Context.Session != null)
   {    if (Session.IsNewSession)
    {
    string szCookieHeader = Request.Headers["Cookie"];
     if ((null != szCookieHeader) && (szCookieHeader.IndexOf("ASP.NET_SessionId") >= 0))
     {
      Response.Redirect("sessionTimeout.htm");
     } 
    }
   }
  }

Posted by Prakash | 2 Comments

Contract Types

The different types of message exchange patterns (mep) that contacts can take : Request -reply,One - way or duplex.

Request-reply services are the default type of operation contract in Windows Communication Foundation (WCF). Clients make call to service operations and wait for a response from the service.

To create request-reply service contract, define your service contract, and apply the OperationContractAttribute class to each operation, as shown in the following sample code.

[ServiceContract(Namespace="http://Microsoft.ServiceModel.Samples")]
public interface ICalculator
{
    [OperationContract]
    double Add(double n1, double n2);
}
Posted by Prakash | 0 Comments
Filed under:

System Provided Bindings

Binding

Configuration Element

Description

BasicHttpBinding

<basicHttpBinding>

A binding that is suitable for communicating with WS-Basic Profile conformant Web services, for example, ASP.NET Web services (ASMX)-based services. This binding uses HTTP as the transport and text/XML as the default message encoding.

WSHttpBinding

<wsHttpBinding>

A secure and interoperable binding that is suitable for nonduplex service contracts.

WSDualHttpBinding

<wsDualHttpBinding>

A secure and interoperable binding that is suitable for duplex service contracts or communication through SOAP intermediaries.

WSFederationHttpBinding

<wsFederationHttpBinding>

A secure and interoperable binding that supports the WS-Federation protocol, enabling organizations that are in a federation to efficiently authenticate and authorize users.

NetTcpBinding

<netTcpBinding>

A secure and optimized binding suitable for cross-machine communication between WCF applications.

NetNamedPipeBinding

<netNamedPipeBinding>

A secure, reliable, optimized binding that is suitable for on-machine communication between WCF applications.

NetMsmqBinding

<netMsmqBinding>

A queued binding that is suitable for cross-machine communication between WCF applications.

NetPeerTcpBinding

<netPeerTcpBinding>

A binding that enables secure, multimachine communication.

MsmqIntegrationBinding

<msmqIntegrationBinding>

A binding that is suitable for cross-machine communication between a WCF application and existing Message Queuing (also known as MSMQ) applications.

Posted by Prakash | 1 Comments
Filed under:

Binding Features

The following table shows some of the key features provided by the system-provided binding.

 

Binding

Interoperability

Mode Of Security

Session

(Default)

Transaction

Duplex

BasicHttpBinding

Basic Profile 1.1

(None), Transport, Message, Mixed

None, (None)

(None)

n/a

WSHttpBinding

WS

None, Transport, (Message), Mixed

(None), Transport, Reliable Session

(None), Yes

n/a

WSDualHttpBinding

WS

None, (Message)

(Reliable Session)

(None), Yes

Yes

WSFederationHttpBinding

WS-Federation

None, (Message), Mixed

(None), Reliable Session

(None), Yes

No

NetTcpBinding

.NET

None, (Transport), Message,

Mixed

Reliable Session, (Transport)

(None), Yes

Yes

NetNamedPipeBinding

.NET

None,

(Transport)

None, (Transport)

(None), Yes

Yes

NetMsmqBinding

.NET

None, Message, (Transport), Both

(None)

(None), Yes

No

NetPeerTcpBinding

Peer

None, Message, (Transport), Mixed

(None)

(None)

Yes

MsmqIntegrationBinding

MSMQ

None, (Transport)

(None)

(None), Yes

n/a

Posted by Prakash | 1 Comments
Filed under:

Enable FxCop / CodeAnalysis for website projects programatically

The following macro programatically enables FxCop / CodeAnalysis for website projects only

 

 

Imports System

Imports EnvDTE

Imports EnvDTE80

Imports System.Diagnostics

 

 

Public Module Module1

Sub Macro1()

Dim proj As EnvDTE.Project

For i As Integer = 1 To DTE.Solution.Projects.Count

            proj = CType(DTE.Solution.Projects.Item(i), EnvDTE.Project)

  If (proj.Kind = "{E24C65DC-7377-472b-9ABA-BC803B73C61A}") Then

    proj.Properties.Item("EnableFxCop").Value = True

proj.Save()

 End If

Next

 

End Sub

 

End Module

Posted by Prakash | 1 Comments
Filed under:

End Point

All communication with a WCF service occurs through EndPoint.

Each Endpoint consists of four properties

1. Address

a. Indicates where the endpoint can be found.

Address contains the URI and identity and optional message headers to contains additional information or more information to identify or interact with the endpoint

2. Binding

a. Specifies as to how to communicate with the endpoint. This includes Transport (http/tcp), Encoding (text /binary) and security requirements.

3. Contract

a. Identifies the operation available. This includes the operation available. Input / output parameters.

4. Behaviour

a. specifies local implementation details of the endpoint

Posted by Prakash | 0 Comments
More Posts Next page »
 
Page view tracker