Welcome to MSDN Blogs Sign in | Join | Help

Fixing jQuery intellisense error for Visual Studio 2008

It happens to you if you are a developer or debugger running VS 2008 and trying to use JavaScript intellisence for your favorite JS library. This just does not happen *only* to jQuery but any Visual Studio JScript document (-vsdoc.js)

You wont get intellisence and you may get warning in VS Error List that look like following :

Warning    1    Error updating JScript IntelliSense: C:\Users\someone\Documents\Visual Studio 2008\Projects\WebApplication1\WebApplication1\script\jquery-1.3.1.min.js: Object doesn't support this property or method @ 18:8308    C:\Users\someone\Documents\Visual Studio 2008\Projects\WebApplication1\WebApplication1\Default.aspx    1    1    WebApplication1

This is a bug in VS 2008 and you have a fix to this issue. You would require SP1 for Visual Studio 2008 before applying the hotfix.

Download from code.msdn.microsoft.com here.

http://code.msdn.microsoft.com/KB958502/Release/ProjectReleases.aspx?ReleaseId=1736

image

Once you are done, you are a happy programmer again smile_wink!!

Posted by Shaans | 0 Comments

Invoke Method by Name

Did you ever wonder how AutoEventWireup="true" works in ASP.NET Pages? The page class basically hooks different generic event handler methods to the page life-cycle.
Such as Page_Load Method get’s called if present. OK!! It’s called using reflection.

public partial class_Default: System.Web.UI.Page
{
    protected voidPage_Load(objectsender, EventArgs e)
    {


    }
}

 

You can use a delegate or MethodInfo object to invoke method with a known signature. Here is a quick test that shows how do you do such in your code

Out test  :

using System;

namespace ConsoleApplication1
{
    class Program
    {
        delegate string TestMessageHandler(string s);

        static void Main(string[] args)
        {
            Delegate dl = Delegate.CreateDelegate(
                typeof(TestMessageHandler),
                typeof(Program),
                "SayHi");

            Console.WriteLine(dl.DynamicInvoke("Bill"));
            Console.ReadLine();
        }
        
        public static string SayHi(string name)
        {
            return "Welcome " + name;
        }        
    }
}

Even you can make this more strongly typed by casting the resulting Delegate object of Delegate.CreateDelegate  to the target delegate (TestMessageHandler)

Have fun..

Posted by Shaans | 0 Comments

SharePoint Development get easy!

One of the major feedback from the development community was about the complexity of setting up development environment.

Microsoft Listened!

Now you would  not need a Windows Server 2008 box to be able to develop applications for SharePoint with Visual Studio 2010. SharePoint Server Foundation (previously known as Windows SharePoint Services or WSS) on Windows 7 & Vista. Sorry XP guys :)

One constraint though, it has to be a x64 OS and you need to go through series of pre defined steps to enable these.

 

Visual Studio 2010 & SharePoint 2010 are good partner for sure.

Posted by Shaans | 0 Comments

Dissecting ASP.NET MVC Framework

Have you already started developing web apps on the new ASP.NET MVC framework? If yes, then you may be wondering how ASP.NET MVC framework works. Here is an walkthrough to dive you deep into the framework‘s internal concepts.

MVC framework is not new but one of the most popular design pattern for UI driven applications. Microsoft has created this wonderful support to allow you develop ASP.NET application based on MVC design patterns.

In order to complete this topic, you must have a working knowledge of ASP.NET Internals. (At least you understand how asp.net works). If not grab a copy of ASP.NET Internals and make yourself familiarized with the core framework.

In this exercise I will use a default MVC project created with ASP.NET MVC 1.0 Web Application project template. The core concept of MVC relies on HttpModule & HttpHandler. Although the article is reasonably lengthy, I have tried to cut code short by removing the part of the code out of discussion and keeping focus on highlighted portion.

When you open up the web.config file in the MVC project, you will notice a reference of HTTPHandler and HttpModule as highlighted below in the system.web/httpHandlers and httpModules.

  1. HttpHandler (path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler”), this handler reference here has not much importance in the context unless you mapped urls that ends with .mvc
    1. This is mostly used in IIS 6 and other scenarios where wildcard mapping for ISAPI Extensions does not work well, or you have specific preference to keep urls end with .mvc
    2. Unless you have above constraint, you can remove the entry above from web.config file.
    3. HttpModule (name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule”), The most critical part of Routing used by MVC framework in ASP.NET
  2. Routing was introduced as part of ASP.NET 3.5 extensions to support dynamics url.
    1. This allows incoming urls to map with custom Http Handler based on URL patterns and various custom filters.
    2. For routing to work, you must add an assembly reference to System.Web.Routing to your project.

We discussed about routing in little more details below.

web.config

    <system.web>

        <siteMap/>

        <compilation debug="true"/>

        <authentication mode="Windows" />

        <customErrors mode="Off"/>

        <pages>

            <controls/>

            <namespaces>

                <add namespace="System.Web.Mvc" />

                <add namespace="System.Web.Mvc.Ajax" />

                <add namespace="System.Web.Mvc.Html" />

                <add namespace="System.Web.Routing" />

            </namespaces>

        </pages>

        <httpHandlers>

            <remove verb="*" path="*.asmx" />

            <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

            <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

            <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" />

            <add verb="*" path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

        </httpHandlers>

        <httpModules>

            <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

            <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

        </httpModules>

    </system.web>

The below routing map sample can be found in the default Global.asax file. ASP.NET MVC applications typically register controller routes in Application_Start event of Global.asax.

Global.asax

 

    public class MvcApplication : System.Web.HttpApplication

    {

        public static void RegisterRoutes(RouteCollection routes){

            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

 

            routes.MapRoute(

                "Default",                                              // Route name

                "{controller}/{action}/{id}",                           // URL with parameters

                new { controller = "Home", action = "Index", id = "" }  // Parameter defaults

            );

 

        }

 

        protected void Application_Start(){

            RegisterRoutes(RouteTable.Routes);

        }

    }

You make use of RouteCollectionExtensions to simplify the task of route mapping. When you use route.MapRoute, actually you add new Route instance of MVCRouteHandler type. Although Routing is part of ASP.NET 3.5 Extension, MVC is not. So you must add an assembly reference of System.Web.Mvc to get access to this extension & MvcRouteHandler.

RouteCollectionExtensions

 

    public static class RouteCollectionExtensions

    {

        public static void IgnoreRoute(this RouteCollection routes, string url);

        public static void IgnoreRoute(this RouteCollection routes, string url, object constraints);

        public static Route MapRoute(this RouteCollection routes, string name, string url);

        public static Route MapRoute(this RouteCollection routes, string name, string url, object defaults);

        public static Route MapRoute(this RouteCollection routes, string name, string url, string[] namespaces);

        public static Route MapRoute(this RouteCollection routes, string name, string url, object defaults, object constraints);

        public static Route MapRoute(this RouteCollection routes, string name, string url, object defaults, string[] namespaces);

 

        public static Route MapRoute(this RouteCollection routes, string name, string url, object defaults, object constraints, string[] namespaces) {

            if (routes == null) {

                throw new ArgumentNullException("routes");

            }

            if (url == null) {

                throw new ArgumentNullException("url");

            }

            Route item = new Route(url, new MvcRouteHandler()){

                Defaults = new RouteValueDictionary(defaults),

                Constraints = new RouteValueDictionary(constraints)

            };

            if ((namespaces != null) && (namespaces.Length > 0)) {

                item.DataTokens = new RouteValueDictionary();

                item.DataTokens["Namespaces"] = namespaces;

            }

            routes.Add(name, item);

            return item;

        }

 

        private sealed class IgnoreRouteInternal : Route

        {

            public IgnoreRouteInternal(string url);

            public override VirtualPathData GetVirtualPath(RequestContext requestContext, RouteValueDictionary routeValues);

        }

    }

 

URL Routing Module

 

The key part of routing happens in the PostMapRequestHandler, PostResolveRequestCache(In case of cached results) events of the HttpModule.

1.       It finds specific Route by matching the request context. The matching works based on different factors such as the url & input parameters.

2.       Then it tries to retreive the RouteHandler from the Route.

3.       And this inturn sets the HttpContext.Handler to new instance of IHttpHandler from IRouteHandler.

 

    public class UrlRoutingModule : IHttpModule

    {

        static UrlRoutingModule();

        public UrlRoutingModule();

        protected virtual void Dispose();

        protected virtual void Init(HttpApplication application);

        private void OnApplicationPostMapRequestHandler(object sender, EventArgs e);

        private void OnApplicationPostResolveRequestCache(object sender, EventArgs e);

       

        /// <summary>

        /// Assigns the HTTP handler for the current request to the context.

        /// </summary>

        public virtual void PostMapRequestHandler(HttpContextBase context) {

            RequestData data = (RequestData)context.Items[_requestDataKey];

            if (data != null) {

                context.RewritePath(data.OriginalPath);

                context.Handler = data.HttpHandler;

            }

        }

 

        /// <summary>

        /// Matches the HTTP request to a route, retrieves the handler for that route, and sets the handler as the HTTP handler for the current request.

        /// </summary>

        public virtual void PostResolveRequestCache(HttpContextBase context) {

            RouteData routeData = this.RouteCollection.GetRouteData(context);

            if (routeData != null) {

                IRouteHandler routeHandler = routeData.RouteHandler;

                if (routeHandler == null) {

                    throw new InvalidOperationException(string.Format(CultureInfo.CurrentUICulture, RoutingResources.UrlRoutingModule_NoRouteHandler, new object[0]));

                }

                if (!(routeHandler is StopRoutingHandler)) {

                    RequestContext requestContext = new RequestContext(context, routeData);

                    IHttpHandler httpHandler = routeHandler.GetHttpHandler(requestContext);

                    if (httpHandler == null) {

                        throw new InvalidOperationException(string.Format(CultureInfo.CurrentUICulture, RoutingResources.UrlRoutingModule_NoHttpHandler, new object[] { routeHandler.GetType() }));

                    }

                    context.Items[_requestDataKey] = new RequestData { OriginalPath = context.Request.Path, HttpHandler = httpHandler };

                    context.RewritePath("~/UrlRouting.axd");

                }

            }

        }

 

        /// <summary>

        /// Initializes a module and prepares it to handle requests.

        /// </summary>

        /// <param name="application">

        /// An object that provides access to the methods, properties, and events common to all application objects in an ASP.NET application.

        /// </param>

        protected virtual void Init(HttpApplication application) {

            application.PostResolveRequestCache += new EventHandler(this.OnApplicationPostResolveRequestCache);

            application.PostMapRequestHandler += new EventHandler(this.OnApplicationPostMapRequestHandler);

        }

 

        public RouteCollection RouteCollection { get; set; }

 

        private class RequestData

        {

            public IHttpHandler HttpHandler { get; set; }

            public string OriginalPath { get; set; }

        }

    }

MVCRouteHandler created new instance of MVCHandler when requested through GetHttpHandler method.

MvcRouteHandler

    public class MvcRouteHandler : IRouteHandler

    {

        // Methods

        protected virtual IHttpHandler GetHttpHandler(RequestContext requestContext) {

            return new MvcHandler(requestContext);

        }

    }

 

Here is magic. ASP.NET Runtime pipeline calles the ProcesRequest method of MvcHandler (HttpHandler)

MvcHandler

    public class MvcHandler : System.Web.IHttpHandler, IRequiresSessionState

    {

        private ControllerBuilder _controllerBuilder;

 

        static MvcHandler();

        public MvcHandler(RequestContext requestContext);

 

        protected virtual void ProcessRequest(HttpContext httpContext) {

            HttpContextBase base2 = new HttpContextWrapper(httpContext);

            this.ProcessRequest(base2);

        }

 

        protected internal virtual void ProcessRequest(HttpContextBase httpContext) {

            this.AddVersionHeader(httpContext);

            string requiredString = this.RequestContext.RouteData.GetRequiredString("controller");

            IControllerFactory controllerFactory = this.ControllerBuilder.GetControllerFactory();

            IController controller = controllerFactory.CreateController(this.RequestContext, requiredString);

            if (controller == null) {

                throw new InvalidOperationException(

                    string.Format(CultureInfo.CurrentUICulture, MvcResources.ControllerBuilder_FactoryReturnedNull,

                    new object[] { controllerFactory.GetType(), requiredString }));

            }

            try{

                controller.Execute(this.RequestContext);

            }

            finally{

                controllerFactory.ReleaseController(controller);

            }

        }

       

        protected virtual bool IsReusable{

            get{return false;}

        }

 

        public RequestContext RequestContext { get; private set; }

 

        internal ControllerBuilder ControllerBuilder{

            get{

                if (this._controllerBuilder == null) {

                    this._controllerBuilder = ControllerBuilder.Current;

                }

                return this._controllerBuilder;

            }

            set{

                this._controllerBuilder = value;

            }

        }

    }

 

 

ControllerBuilder

 

    public class ControllerBuilder {

 

        private Func<IControllerFactory> _factoryThunk;

        private static ControllerBuilder _instance = new ControllerBuilder();

        private HashSet<string> _namespaces = new HashSet<string>(StringComparer.OrdinalIgnoreCase);

 

        public ControllerBuilder() {

            SetControllerFactory(new DefaultControllerFactory() {

                ControllerBuilder = this

            });

        }

 

        public static ControllerBuilder Current {

            get {

                return _instance;

            }

        }

 

        public HashSet<string> DefaultNamespaces {

            get {

                return _namespaces;

            }

        }

 

        public IControllerFactory GetControllerFactory() {

            IControllerFactory controllerFactoryInstance = _factoryThunk();

            return controllerFactoryInstance;

        }

 

        public void SetControllerFactory(IControllerFactory controllerFactory) {

                  ...

        }

 

        public void SetControllerFactory(Type controllerFactoryType) {

                  ...

        }

    }

 

DefaultControllerFactory

 

    public class DefaultControllerFactory : IControllerFactory {

 

        private IBuildManager _buildManager;

        private ControllerBuilder _controllerBuilder;

        private ControllerTypeCache _instanceControllerTypeCache;

        private static ControllerTypeCache _staticControllerTypeCache = new ControllerTypeCache();

 

        public virtual IController CreateController(RequestContext requestContext, string controllerName) {

            if (requestContext == null) {

                throw new ArgumentNullException("requestContext");

            }

            if (String.IsNullOrEmpty(controllerName)) {

                throw new ArgumentException(MvcResources.Common_NullOrEmpty, "controllerName");

            }

            Type controllerType = GetControllerType(requestContext, controllerName);

            IController controller = GetControllerInstance(requestContext, controllerType);

            return controller;

        }

 

        protected internal virtual IController GetControllerInstance(RequestContext requestContext, Type controllerType) {

            if (controllerType == null) {

                throw new HttpException(404,

                    String.Format(

                        CultureInfo.CurrentUICulture,

                        MvcResources.DefaultControllerFactory_NoControllerFound,

                        requestContext.HttpContext.Request.Path));

            }

            if (!typeof(IController).IsAssignableFrom(controllerType)) {

                throw new ArgumentException(

                    String.Format(

                        CultureInfo.CurrentUICulture,

                        MvcResources.DefaultControllerFactory_TypeDoesNotSubclassControllerBase,

                        controllerType),

                    "controllerType");

            }

            try {

                return (IController)Activator.CreateInstance(controllerType);

            }

            catch (Exception ex) {

                throw new InvalidOperationException(

                    String.Format(

                        CultureInfo.CurrentUICulture,

                        MvcResources.DefaultControllerFactory_ErrorCreatingController,

                        controllerType),

                    ex);

            }

        }

 

        protected internal virtual Type GetControllerType(RequestContext requestContext, string controllerName) {

            if (String.IsNullOrEmpty(controllerName)) {

                throw new ArgumentException(MvcResources.Common_NullOrEmpty, "controllerName");

            }

 

            // first search in the current route's namespace collection

            object routeNamespacesObj;

            Type match;

            if (requestContext != null && requestContext.RouteData.DataTokens.TryGetValue("Namespaces", out routeNamespacesObj)) {

                IEnumerable<string> routeNamespaces = routeNamespacesObj as IEnumerable<string>;

                if (routeNamespaces != null) {

                    HashSet<string> nsHash = new HashSet<string>(routeNamespaces, StringComparer.OrdinalIgnoreCase);

                    match = GetControllerTypeWithinNamespaces(controllerName, nsHash);

 

                    // the UseNamespaceFallback key might not exist, in which case its value is implicitly "true"

                    if (match != null || false.Equals(requestContext.RouteData.DataTokens["UseNamespaceFallback"])) {

                        // got a match or the route requested we stop looking

                        return match;

                    }

                }

            }

 

            // then search in the application's default namespace collection

            HashSet<string> nsDefaults = new HashSet<string>(ControllerBuilder.DefaultNamespaces, StringComparer.OrdinalIgnoreCase);

            match = GetControllerTypeWithinNamespaces(controllerName, nsDefaults);

            if (match != null) {

                return match;

            }

 

            // if all else fails, search every namespace

            return GetControllerTypeWithinNamespaces(controllerName, null /* namespaces */);

        }

 

        private Type GetControllerTypeWithinNamespaces(string controllerName, HashSet<string> namespaces) {

            // Once the master list of controllers has been created we can quickly index into it

            ControllerTypeCache.EnsureInitialized(BuildManager);

 

            ICollection<Type> matchingTypes = ControllerTypeCache.GetControllerTypes(controllerName, namespaces);

            switch (matchingTypes.Count) {

                case 0:

                    // no matching types

                    return null;

 

                case 1:

                    // single matching type

                    return matchingTypes.First();

 

                default:

                    // multiple matching types

                    // we need to generate an exception containing all the controller types

                    StringBuilder sb = new StringBuilder();

                    foreach (Type matchedType in matchingTypes) {

                        sb.AppendLine();

                        sb.Append(matchedType.FullName);

                    }

                    throw new InvalidOperationException(

                        String.Format(

                            CultureInfo.CurrentUICulture,

                            MvcResources.DefaultControllerFactory_ControllerNameAmbiguous,

                            controllerName, sb));

            }

        }

 

        public virtual void ReleaseController(IController controller) {

            IDisposable disposable = controller as IDisposable;

            if (disposable != null) {

                disposable.Dispose();

            }

        }

    }

 

Your Controller

    using System.Web.Mvc;

 

    namespace MvcApplication1.Controllers

    {

        [HandleError]

        public class HomeController : System.Web.Mvc.Controller{

            public ActionResult Index(){

                ViewData["Message"] = "Welcome to ASP.NET MVC!";

                return View();

            }

 

            public ActionResult About(){

                return View();

            }

        }

    }

IController

    namespace System.Web.Mvc {

        using System.Web.Routing;

 

        public interface IController {

            void Execute(RequestContext requestContext);

        }

    }

 

ControllerBase

    public abstract class ControllerBase : IController {

        public ControllerContext ControllerContext {

            get;

            set;

        }

 

        [SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly",

            Justification = "This property is settable so that unit tests can provide mock implementations.")]

        public TempDataDictionary TempData {

            get;

            set;

        }

 

        [SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly",

            Justification = "This property is settable so that unit tests can provide mock implementations.")]

        public ViewDataDictionary ViewData {

            get;

            set;

        }

 

        protected virtual void Execute(RequestContext requestContext) {

            if (requestContext == null) {

                throw new ArgumentNullException("requestContext");

            }

 

            VerifyExecuteCalledOnce();

            Initialize(requestContext);

            ExecuteCore();

        }

 

        protected abstract void ExecuteCore();

 

        protected virtual void Initialize(RequestContext requestContext) {

            ControllerContext = new ControllerContext(requestContext, this);

        }

    }

 

Controller

   public abstract class Controller : ControllerBase, IActionFilter, IAuthorizationFilter, IDisposable, IExceptionFilter, IResultFilter {

 

        public IActionInvoker ActionInvoker {

            get {

                if (_actionInvoker == null) {

                    _actionInvoker = CreateActionInvoker();

                }

                return _actionInvoker;

            }

            set {

                _actionInvoker = value;

            }

        }

 

 

        protected virtual IActionInvoker CreateActionInvoker() {

            return new ControllerActionInvoker();

        }

 

        protected override void ExecuteCore() {

            TempData.Load(ControllerContext, TempDataProvider);

 

            try {

                string actionName = RouteData.GetRequiredString("action");

                if (!ActionInvoker.InvokeAction(ControllerContext, actionName)) {

                    HandleUnknownAction(actionName);

                }

            }

            finally {

                TempData.Save(ControllerContext, TempDataProvider);

            }

        }

 

        protected override void Initialize(RequestContext requestContext) {

            base.Initialize(requestContext);

            Url = new UrlHelper(requestContext);

        }

 

        protected virtual void HandleUnknownAction(string actionName) {

            throw new HttpException(404, String.Format(CultureInfo.CurrentUICulture,

                MvcResources.Controller_UnknownAction, actionName, GetType().FullName));

        }

 

        protected virtual IActionInvoker CreateActionInvoker() {

            return new ControllerActionInvoker();

        }

 

 

        protected internal ViewResult View() {

            return View(null /* viewName */, null /* masterName */, null /* model */);

        }

 

        protected internal virtual ViewResult View(string viewName, string masterName, object model) {

            if (model != null) {

                ViewData.Model = model;

            }

 

            return new ViewResult {

                ViewName = viewName,

                MasterName = masterName,

                ViewData = ViewData,

                TempData = TempData

            };

        }

    }

ControllerActionInvoker

    public class ControllerActionInvoker : IActionInvoker

    {

        public virtual bool InvokeAction(ControllerContext controllerContext, string actionName){

            if (controllerContext == null){

                throw new ArgumentNullException("controllerContext");

            }

            if (string.IsNullOrEmpty(actionName)){

                throw new ArgumentException(MvcResources.Common_NullOrEmpty, "actionName");

            }

            ControllerDescriptor controllerDescriptor = this.GetControllerDescriptor(controllerContext);

            ActionDescriptor actionDescriptor = this.FindAction(controllerContext, controllerDescriptor, actionName);

            if (actionDescriptor == null){

                return false;

            }

            FilterInfo filters = this.GetFilters(controllerContext, actionDescriptor);

            try

            {

                AuthorizationContext context = this.InvokeAuthorizationFilters(controllerContext, filters.AuthorizationFilters, actionDescriptor);

                if (context.Result != null){

                    this.InvokeActionResult(controllerContext, context.Result);

                }

                else{

                    if (controllerContext.Controller.ValidateRequest){

                        ValidateRequest(controllerContext.HttpContext.Request);

                    }

                    IDictionary<string, object> parameterValues = this.GetParameterValues(controllerContext, actionDescriptor);

                    ActionExecutedContext context2 = this.InvokeActionMethodWithFilters(controllerContext, filters.ActionFilters, actionDescriptor, parameterValues);

                    this.InvokeActionResultWithFilters(controllerContext, filters.ResultFilters, context2.Result);

                }

            }

            catch (ThreadAbortException){

                throw;

            }

            catch (Exception exception){

                ExceptionContext context3 = this.InvokeExceptionFilters(controllerContext, filters.ExceptionFilters, exception);

                if (!context3.ExceptionHandled){

                    throw;

                }

                this.InvokeActionResult(controllerContext, context3.Result);

            }

            return true;

        }

 

        protected virtual void InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) {

            actionResult.ExecuteResult(controllerContext);

        }

 

        protected virtual ActionDescriptor FindAction(ControllerContext controllerContext, ControllerDescriptor controllerDescriptor, string actionName) {

            return controllerDescriptor.FindAction(controllerContext, actionName);

        }

    }

 

 

    public abstract class ActionResult

    {

        public abstract void ExecuteResult(ControllerContext context);

    }

 

 

    public abstract class ViewResultBase : ActionResult {

        public TempDataDictionary TempData {

            get ;

            set ;

        }

 

        public IView View {

            get;

            set;

        }

 

        public ViewDataDictionary ViewData {

            get ;

            set ;

        }

 

        public ViewEngineCollection ViewEngineCollection {

            get {

                return _viewEngineCollection ?? ViewEngines.Engines;

            }

            set {

                _viewEngineCollection = value;

            }

        }

 

        public string ViewName {

            get {

                return _viewName ?? String.Empty;

            }

            set {

                _viewName = value;

            }

        }

 

        public override void ExecuteResult(ControllerContext context) {

            if (context == null) {

                throw new ArgumentNullException("context");

            }

            if (String.IsNullOrEmpty(ViewName)) {

                ViewName = context.RouteData.GetRequiredString("action");

            }

 

            ViewEngineResult result = null;

 

            if (View == null) {

                result = FindView(context);

                View = result.View;

            }

 

            ViewContext viewContext = new ViewContext(context, View, ViewData, TempData);

            View.Render(viewContext, context.HttpContext.Response.Output);

 

            if (result != null) {

                result.ViewEngine.ReleaseView(context, View);

            }

        }

 

        protected abstract ViewEngineResult FindView(ControllerContext context);

    }

 

    public class ViewResult : ViewResultBase {

        private string _masterName;

 

        public string MasterName {

            get {

                return _masterName ?? String.Empty;

            }

            set {

                _masterName = value;

            }

        }

 

        protected override ViewEngineResult FindView(ControllerContext context) {

            ViewEngineResult result = ViewEngineCollection.FindView(context, ViewName, MasterName);

            if (result.View != null) {

                return result;

            }

 

            // we need to generate an exception containing all the locations we searched

            StringBuilder locationsText = new StringBuilder();

            foreach (string location in result.SearchedLocations) {

                locationsText.AppendLine();

                locationsText.Append(location);

            }

            throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture,

                MvcResources.Common_ViewNotFound, ViewName, locationsText));

        }

    }

 

public static class ViewEngines {

        private readonly static ViewEngineCollection _engines = new ViewEngineCollection {

            new WebFormViewEngine()

        };

 

        public static ViewEngineCollection Engines {

            get {

                return _engines;

            }

        }

    }

 

VirtualPathProviderViewEngine

 

    public abstract class VirtualPathProviderViewEngine : IViewEngine {    

        protected abstract IView CreatePartialView(ControllerContext controllerContext, string partialPath);

        protected abstract IView CreateView(ControllerContext controllerContext, string viewPath, string masterPath);

 

        protected virtual bool FileExists(ControllerContext controllerContext, string virtualPath) {

            return VirtualPathProvider.FileExists(virtualPath);

        }

 

        public virtual ViewEngineResult FindView(ControllerContext controllerContext, string viewName, string masterName, bool useCache) {

            if (controllerContext == null) {

                throw new ArgumentNullException("controllerContext");

            }

            if (String.IsNullOrEmpty(viewName)) {

                throw new ArgumentException(MvcResources.Common_NullOrEmpty, "viewName");

            }

 

            string[] viewLocationsSearched;

            string[] masterLocationsSearched;

 

            string controllerName = controllerContext.RouteData.GetRequiredString("controller");

            string viewPath = GetPath(controllerContext, ViewLocationFormats, AreaViewLocationFormats, "ViewLocationFormats", viewName, controllerName, _cacheKeyPrefix_View, useCache, out viewLocationsSearched);

            string masterPath = GetPath(controllerContext, MasterLocationFormats, AreaMasterLocationFormats, "MasterLocationFormats", masterName, controllerName, _cacheKeyPrefix_Master, useCache, out masterLocationsSearched);

 

            if (String.IsNullOrEmpty(viewPath) || (String.IsNullOrEmpty(masterPath) && !String.IsNullOrEmpty(masterName))) {

                return new ViewEngineResult(viewLocationsSearched.Union(masterLocationsSearched));

            }

 

            return new ViewEngineResult(CreateView(controllerContext, viewPath, masterPath), this);

        }

 

        private class ViewLocation {

 

        }

 

        private class AreaAwareViewLocation : ViewLocation {

 

        }

    }

 

    public class WebFormViewEngine : VirtualPathProviderViewEngine {

 

        private IBuildManager _buildManager;

 

        public WebFormViewEngine() {

            MasterLocationFormats = new[] {

                "~/Views/{1}/{0}.master",

                "~/Views/Shared/{0}.master"

            };

 

            AreaMasterLocationFormats = new[] {

                "~/Areas/{2}/Views/{1}/{0}.master",

                "~/Areas/{2}/Views/Shared/{0}.master",

                "~/Views/Areas/{2}/{1}/{0}.master",

                "~/Views/Areas/{2}/Shared/{0}.master"

            };

 

            ViewLocationFormats = new[] {

                "~/Views/{1}/{0}.aspx",

                "~/Views/{1}/{0}.ascx",

                "~/Views/Shared/{0}.aspx",

                "~/Views/Shared/{0}.ascx"

            };

 

            AreaViewLocationFormats = new[] {

                "~/Areas/{2}/Views/{1}/{0}.aspx",

                "~/Areas/{2}/Views/{1}/{0}.ascx",

                "~/Areas/{2}/Views/Shared/{0}.aspx",

                "~/Areas/{2}/Views/Shared/{0}.ascx",

                "~/Views/Areas/{2}/{1}/{0}.aspx",

                "~/Views/Areas/{2}/{1}/{0}.ascx",

                "~/Views/Areas/{2}/Shared/{0}.aspx",

                "~/Views/Areas/{2}/Shared/{0}.ascx"

            };

 

            PartialViewLocationFormats = ViewLocationFormats;

            AreaPartialViewLocationFormats = AreaViewLocationFormats;

        }

 

        protected override IView CreatePartialView(ControllerContext controllerContext, string partialPath) {

            return new WebFormView(partialPath, null);

        }

 

        protected override IView CreateView(ControllerContext controllerContext, string viewPath, string masterPath) {

            return new WebFormView(viewPath, masterPath);

        }

 

    }

 

public class WebFormView : IView {

        public WebFormView(string viewPath, string masterPath) {

            if (String.IsNullOrEmpty(viewPath)) {

                throw new ArgumentException(MvcResources.Common_NullOrEmpty, "viewPath");

            }

 

            ViewPath = viewPath;

            MasterPath = masterPath ?? String.Empty;

        }

 

     

        public virtual void Render(ViewContext viewContext, TextWriter writer) {

            if (viewContext == null) {

                throw new ArgumentNullException("viewContext");

            }

 

            object viewInstance = BuildManager.CreateInstanceFromVirtualPath(ViewPath, typeof(object));

            if (viewInstance == null) {

                throw new InvalidOperationException(

                    String.Format(

                        CultureInfo.CurrentUICulture,

                        MvcResources.WebFormViewEngine_ViewCouldNotBeCreated,

                        ViewPath));

            }

 

            ViewPage viewPage = viewInstance as ViewPage;

            if (viewPage != null) {

                RenderViewPage(viewContext, viewPage, writer);

                return;

            }

 

            ViewUserControl viewUserControl = viewInstance as ViewUserControl;

            if (viewUserControl != null) {

                RenderViewUserControl(viewContext, viewUserControl, writer);

                return;

            }

 

            throw new InvalidOperationException(

                String.Format(

                    CultureInfo.CurrentUICulture,

                    MvcResources.WebFormViewEngine_WrongViewBase,

                    ViewPath));

        }

 

        private void RenderViewPage(ViewContext context, ViewPage page, TextWriter textWriter) {

            if (!String.IsNullOrEmpty(MasterPath)) {

                page.MasterLocation = MasterPath;

            }

 

            page.ViewData = context.ViewData;

            page.SetTextWriter(textWriter);

            page.RenderView(context);

        }

 

        private void RenderViewUserControl(ViewContext context, ViewUserControl control, TextWriter textWriter) {

            if (!String.IsNullOrEmpty(MasterPath)) {

                throw new InvalidOperationException(MvcResources.WebFormViewEngine_UserControlCannotHaveMaster);

            }

 

            control.ViewData = context.ViewData;

            control.SetTextWriter(textWriter);

            control.RenderView(context);

        }

    }

 

RouteCollection

 

    public class RouteCollection : System.Collections.ObjectModel.Collection<RouteBase>

    {

        // Fields

        private Dictionary<string, RouteBase> _namedMap;

 

        public RouteCollection();

        public RouteCollection(VirtualPathProvider virtualPathProvider);

 

        public void Add(string name, RouteBase item);

 

        public RouteData GetRouteData(HttpContextBase httpContext)

        {

            if (httpContext == null)

            {

                throw new ArgumentNullException("httpContext");

            }

            if (httpContext.Request == null)

            {

                throw new ArgumentException(RoutingResources.RouteTable_ContextMissingRequest, "httpContext");

            }

            if (!this.RouteExistingFiles)

            {

                string appRelativeCurrentExecutionFilePath = httpContext.Request.AppRelativeCurrentExecutionFilePath;

                if (((appRelativeCurrentExecutionFilePath != "~/") && (this._vpp != null)) && (this._vpp.FileExists(appRelativeCurrentExecutionFilePath) || this._vpp.DirectoryExists(appRelativeCurrentExecutionFilePath)))

                {

                    return null;

                }

            }

            using (this.GetReadLock())

            {

                foreach (RouteBase base2 in this)

                {

                    RouteData routeData = base2.GetRouteData(httpContext);

                    if (routeData != null)

                    {

                        return routeData;

                    }

                }

            }

            return null;

        }

    }

 

 

Route

    public class Route : RouteBase

    {

        /// <summary>

        /// Returns information about the requested route.

        /// </summary>

        /// <param name="httpContext"></param>

        /// <returns></returns>

        public override RouteData GetRouteData(HttpContextBase httpContext)

        {

            string virtualPath = httpContext.Request.AppRelativeCurrentExecutionFilePath.Substring(2) + httpContext.Request.PathInfo;

            RouteValueDictionary values = this._parsedRoute.Match(virtualPath, this.Defaults);

            if (values == null)

            {

                return null;

            }

            RouteData data = new RouteData(this, this.RouteHandler);

            if (!this.ProcessConstraints(httpContext, values, RouteDirection.IncomingRequest))

            {

                return null;

            }

            foreach (KeyValuePair<string, object> pair in values)

            {

                data.Values.Add(pair.Key, pair.Value);

            }

            if (this.DataTokens != null)

            {

                foreach (KeyValuePair<string, object> pair2 in this.DataTokens)

                {

                    data.DataTokens[pair2.Key] = pair2.Value;

                }

            }

            return data;

        }

 

        private bool ProcessConstraints(HttpContextBase httpContext, RouteValueDictionary values, RouteDirection routeDirection)

        {

            if (this.Constraints != null)

            {

                foreach (KeyValuePair<string, object> pair in this.Constraints)

                {

                    if (!this.ProcessConstraint(httpContext, pair.Value, pair.Key, values, routeDirection))

                    {

                        return false;

                    }

                }

            }

            return true;

        }

 

        public string Url

        {

            get

            {

                return (this._url ?? string.Empty);

            }

            set

            {

                this._parsedRoute = RouteParser.Parse(value);

                this._url = value;

            }

        }

    }

 

 

Posted by Shaans | 0 Comments

New features in ASP.NET MVC 2 Preview

New Features

This section describes features that have been introduced in the MVC 2 Preview 2 release.

ModelMetadata and ModelMetadataProvider Classes

The ModelMetadataProvider class provides an abstraction for obtaining metadata for the model within a view. MVC includes a default provider which surfaces the metadata that is exposed by the attributes in the System.ComponentModel.DataAnnotations namespace. It is possible to create metadata providers that provide metadata from other data stores, databases, XML files, and so on.

The ViewDataDictionary class exposes a ModelMetada object that contains the metadata that is extracted from the model by the ModelMetadataProvider class. This allows the templated helpers to consume this metadata and adjust their output accordingly.

For more information, see the documentation for ModelMetadata and ModelMetadataProvider.

Model Validator Providers

The model validation providers class provides an abstraction for obtaining validation logic for the model. ASP.NET MVC includes a default provider based on Data Annotations validation attributes that are included in the System.ComponentModel.DataAnnotations namespace. You can also create custom validation providers that define custom validation rules and custom mappings of validation rules to the model. For more information, see the documentation for ModelValidatorProvider.

Client-Side Validation

The model validator provider class exposes validation metadata to the browser in the form of JSON-serialized metadata that can be consumed by a client-side validation library. The provider class allows you to use other client validation frameworks by writing an adapter that processes the JSON metadata and calls into the alternate client validation library.

ASP.NET MVC Preview 2 includes the jQuery validation library and a client-side validation adapter for that library. The adapter supports the following DataAnnotations namespace validation attributes:

· StringLengthAttribute

· RequiredAttribute

· RegexAttribute

· RangeAttribute

For a walkthrough of how to use client-side validation with ASP.NET MVC, see Client Side Validation in ASP.NET MVC on the MSDN Web site.

New Code Snippets for Visual Studio 2010

A set of HTML code snippets for MVC 2 is installed with Visual Studio 2010 Beta 2. To view a list of these snippets, in the Tools menu, select Code Snippets Manager. For the language, select HTML, and for location, select ASP.NET MVC 2. For more information about how to use code snippets, see the Visual Studio documentation.

New RequireHttpsAttribute Action Filter

ASP.NET MVC 2 Preview 2 includes a new RequireHttpsAttribute class that can be applied to action methods and controllers. By default, the filter redirects non-SSL (HTTP) requests to the SSL-enabled (HTTPS) equivalent.

Overriding the HTTP Method Verb

When you build a Web site by using the REST architectural style, HTTP verbs are used to determine which action to perform for a resource. REST requires that applications support the full range of common HTTP verbs, such as GET, PUT, POST, and DELETE.

ASP.NET MVC includes attributes that you can apply to action methods and that enable ASP.NET MVC to select an action method based on the HTTP verb. In the following example, a POST request will call the first action method and a PUT request will call the second action method.

[HttpPost]

public ActionResult Edit(int id)

[HttpPut]

public ActionResult Edit(int id, Tag tag)

Because not all user agents support all HTTP verbs, a new HttpMethodOverride HTML helper method renders a hidden form input element that causes the form to appear to be a have been submitted with a different HTTP method from the one that was actually used. For example, browsers typically support only the GET and POST verbs in HTML forms. By using the HttpMethodOverride HTML helper method, you can have a form support PUT, DELETE, and other HTTP verbs.

The behavior of HttpMethodOverride affects the following attributes:

· HttpPostAttribute

· HttpPutAttribute

· HttpGetAttribute

· HttpDeleteAttribute

· AcceptVerbsAttribute

The HttpMethodOverride HTML helper method renders a hidden input element that has the name X-HTTP-Method-Override and the value set to the HTTP verb. The override value can also be specified in an HTTP header or in a query string value as a name/value pair.

The override is valid only for POST requests. The override values will be ignored for requests that use any other HTTP verb.

Single-Project Areas

ASP.NET MVC 2 Preview 2 includes support for single-project areas, which expands the existing support for multiple-project areas. The following figure shows the sample project layout for a single-project area.

clip_image002

For each area in the project, you must add a class that derives from AreaRegistration, and you must provide information about the area in the overridden members of that class, as shown in the following example:

namespace MyApplication.Areas.Blog {

public class Routes : AreaRegistration {

public override string AreaName {

get { return "blog"; }

}

public override void RegisterArea(AreaRegistrationContext context) {

context.MapRoute(

"blog_default",

"blog/{controller}/{action}/{id}",

new { controller = "Home", action = "Index", id = "" }

);

context.MapRoute(

"blog_whatsnew",

"whats-new",

new { controller = "Home", action = "WhatsNew", id = "" }

);

}

}

}

In the Global.asax code, add a call to the RegisterAllAreas method in order to register all areas. This method looks for all types that derive from the AreaRegistration class, instantiates the class, and then calls the RegisterArea method on the class. The following example shows how to do this.

public class MyMvcApplication : HttpApplication {

void App_Start() {

AreaRegistration.RegisterAllAreas();

RegisterRoutes(RouteTable.Routes);

}

public static void RegisterRoutes(RouteCollection routes) {

routes.MapRoute("default", "{controller}/{action}/{id}", ...);

}

}

If you do not specify the namespace in the RegisterArea method by calling the context.Namespaces.Add method, the namespace of the registration class is used by default.

For more information, see Walkthrough: Creating an ASP.NET MVC Areas Application Using a Single Project on the MSDN Web site.

New HiddenInputAttribute for Templated Helpers

When the new HiddenInputAttribute class is applied to a property, the attribute indicates to the editor template whether a hidden input element should be rendered when editing the model. (The attribute sets an implicit UIHint value of HiddenInput). The DisplayValue property allows you to control whether the value is displayed in editor and display modes. When the attribute is set to false, nothing is displayed (not even the HTML markup that normally surrounds a field).

You might use this attribute in the following scenarios:

· When a view lets users edit the ID of an object and it is necessary to display the value as well as to provide a hidden input element that contains the old ID so that it can be passed back to the controller.

· When a view lets users edit a binary property that should never be displayed, such as a timestamp property. In that case, the value and surrounding HTML markup (such as the label and value) are not displayed.

The following example shows how to use the HiddenInputAttribute class.

public class ProductViewModel {

[HiddenInput] // equivalent to [HiddenInput(DisplayValue=true)]

public int Id { get; set; }

public string Name { get; set; }

[HiddenInput(DisplayValue=false)]

public byte[] TimeStamp { get; set; }

}

When the attribute is set to true (or no parameter is specified), the following occurs:

· In display templates, a label is rendered and the value is displayed to the user.

· In editor templates, a label is rendered and the value is rendered in a hidden input element.

When the attribute is set to false, the following occurs:

· In display templates, nothing is rendered for that field.

· In editor templates, no label is rendered and the value is rendered in a hidden input element.

Other Improvements

The following additional changes have been made to existing types and members for ASP.NET MVC 2 Preview 2.

· Removed the IsNullableValueType property from the TemplateInfo class and added it to ModelMetadata. When ASP.NET MVC looks up a template for Nullable<T>, the type of T is used for the type-based template lookup. This new property lets the template author know that the original value was a nullable type.

· Changed the Controller.Execute method to throw an exception when it is called more than once on the same instance. Controllers are meant to serve a single request and to be executed only once. Many developers were running into subtle bugs when they accidentally set an Inversion of Control (IoC) container to return a singleton instance of a controller rather than a new instance per request. This change makes the contract for controllers explicit.

· Changed templated helpers to return their output as a string rather than writing the output directly to the response. Before this change, the helpers returned an empty string and wrote their output directly to the response.

· Changed the Controller class so that it no longer inherits from MarshalByRefObject.

· Added support for the DataType.Password enumeration value for the DataTypeAttribute class. When a property is marked with this attribute, the default editor template will render a password input element.

· Made the AuthorizationContext(ControllerContext context) constructor obsolete. Instead, use the constructor that accepts both a ControllerContext parameter and an ActionDescriptor parameter.

· Made performance improvements to expression-based helper methods such as the template helpers. Helpers now cache compiled LINQ expressions.

· Added TemplateInfo.GetFullHtmlID and Html.GenerateIDFromName methods that are used to generate the recommended HTML id attribute value for an element within a template. This helps template authors make sure their templates work when they are nested in other templates.

· Added new attributes for simple REST scenarios, including HttpPutAttribute, HttpDeleteAttribute, and HttpGetAttribute. For more information, see Overriding the HTTP Method Override Verb earlier in this document.

· Changed the default editor template for nullable Boolean values to render a drop-down list that has three options: “Not Set”, “True”, and “False”. When “Not Set” is selected, the value that is submitted to the server is an empty string.

· Changed model types so that they can be either value types or reference types. This allows view pages and other types to support built-in .NET Framework value types such as System.DateTime and System.Int32.

· Changed the framework so that if a controller namespace is specified as part of a route registration (for example, by using the namespaces parameter in a call to the MapRoute method), the framework now looks in that namespace and its children for potential controller matches. For example, if the namespace MyNamespace is specified, the framework will look in the equivalent of MyNamespace.* for a matching controller.

· Renamed the htmlFieldPrefixId parameter for the template helper methods to htmlFieldPrefixName, and renamed TemplateInfo.GetFullHtmlFieldId renamed to TemplatInfo.GetFullHtmlFieldName. The new names better represent the purpose of the parameter and property.

Posted by Shaans | 0 Comments

Old school data binding for List controls in ASP.NET MVC

The ASP.NET MVC is designed for Performance and extensibility and testability in mind. MVC 1.0 comes with handful of HTML extensions that allows you render textboxes, dropdowns and other controls. While you are creating a DropDownList or List box you may require this little extension to bind your control to existing data source such as Linq2Sql or dataset.

For an example :

<%= Html.DropDownList("jobcategory", Model.JobCategory)%>
Error 2 Argument '3': cannot convert from 'JobCategoryDataTable' to 
'System.Collections.Generic.IEnumerable' d:\Projects\ShellMvc2\Views\Search\SearchControls.ascx 11 46 ShellMvc2

where Model.JobCategory is the Linq2Sql object collection. I wonder if it was ASP.NET I had DataTextField and DataValueField.

Here we go with custom list extension:

<%= Html.DropDownList("jobcategory", Model.JobCategory.ToSelectList("JobCategoryId", "JobCategory")%>

Where Model.JobCategory is the data source, this can be any type of IEnumerable source such as IDataReader, DataTable, List2Sql or any CustomObject collection.

First parameter JobCategoryId is the DataDisplayField and the second parameter is the DataValueField. This extension can further be improved by creating custom of IEnumerator<SelectListItem>

using System.Collections;
using System.Collections.Generic;
using System.Web.Mvc;
using System.Web.UI;
public static class MyExtensions
{
    public static IEnumerable<SelectListItem> ToSelectList(this IEnumerable collection, string displayField, string valueField)
    {
        return ToSelectList(collection, displayField, valueField, null);
    }
 
    public static IEnumerable<SelectListItem> ToSelectList(this IEnumerable collection,
string displayField, string valueField, string selectedValue)
    {
        List<SelectListItem> list = new List<SelectListItem>();
        foreach (var item in collection)
        {
            string value = DataBinder.GetPropertyValue(item, valueField).ToString();
            list.Add(new SelectListItem
            {
                Text = DataBinder.GetPropertyValue(item, displayField).ToString(),
                Value = value,
                Selected = (value.Equals(selectedValue))
            });
        }
        return list;
    }
}
Posted by Shaans | 1 Comments

Run Powerful virtual desktops on Windows 7

Download Windows Virtual PC from Microsoft Download Centre. You may also get readily available Windows XP virtual PC to run along.

http://www.microsoft.com/windows/virtual-pc/download.aspx

Select your OS type and language for Windows XP Mode.

image

Save the file and open to install this as Windows Update on you Windows 7 PC

 You must restart after installation is over.

image

After Windows  is restarted you can find the Windows Virtual PC in
StartMenu –> All Programs-> Windows Virtual PC

 image

To create new Virtual Machine select Create Virtual Machine from the explorer toolbar as shown in the following picture.  image 

If you see the following dialog, your system may not support Hardware assisted virtualization or Virtualization may not be enabled at BIOSimage

  • Restart the computer and enter BIOS setup.
    • In Dell PCs (F12), HP (F1) (press F12/F1 at the system start up) watch system bios start message carefully.
  • Search virtualization setting in BIOS and enable the setting.
  • Save BIOS settings.
  • Power off the computer, wait for few seconds and start the computer.

After you are done, you can retry

image

image

image

Make sure you have inserted the Windows OS disk and start the newly created VM

image

You are done !!

image

Posted by Shaans | 0 Comments

What is new for web developers in ASP 4

ASP.NET MVC support is not released as part of Beta 1 but will be included in Beta 2

http://www.asp.net/learn/whitepapers/aspnet40/

  1. Core Services
    1. Extensible Output Caching
    2. Auto-Start Web Applications
    3. Permanently Redirecting a Page
    4. The Incredible Shrinking Session State
  2. AJAX Functionality in ASP.NET 4.0
    1. Client Template Rendering
    2. Instantiating Behaviors and Controls Declaratively
    3. Live Data Binding
    4. Using the Observer Pattern with JavaScript Objects and Arrays
    5. The DataView Control
    6. The AdoNetServiceProxy Class
    7. The DataContext and AdoNetDataContext Classes
    8. Refactoring the Microsoft AJAX Framework Libraries
  3. Web Forms
    1. Setting Meta Tags with the Page.Keywords and Page.Description Properties
    2. Enabling View State for Individual Controls
    3. Changes to Browser Capabilities
    4. Routing in ASP.NET 4.0
    5. Setting Client IDs
    6. Persisting Row Selection in Data Controls
    7. FormView Control Enhancements
    8. ListView Control Enhancements
    9. Filtering Data with the QueryExtender Control
  4. Dynamic Data
    1. Declarative DynamicDataManager Control Syntax
    2. Entity Templates
    3. New Field Templates for URLs and E-mail Addresses
    4. Creating Links with the DynamicHyperLink Control
    5. Support for Inheritance in the Data Model
    6. Support for Many-to-Many Relationships (Entity Framework Only)
    7. New Attributes to Control Display and Support Enumerations
    8. Enhanced Support for Filters
  5. Visual Studio 2010 Web Designer Improvements
    1. Improved CSS Compatibility
    2. HTML and JScript Snippets
    3. JScript IntelliSense Enhancements
  6. Web Application Deployment with Visual Studio 2010
    1. Web Packaging
    2. Web.Config Transformation
    3. Database Deployment
    4. One-Click Publishing
Posted by Shaans | 1 Comments

SharePoint Custom Actions

If you are developing a SharePoint feature and adding custom actions to various menus, the following is the table containing Default Custom Action Locations and IDs.

DisplayFormToolbar

N/A

Location corresponds to the display form toolbar of lists.

ExportEventToolbarButton (calendars)

ExportContactToolbarButton (contacts)

EditControlBlock

N/A

Corresponds to the per-item edit control block (ECB) menu.

 

EditFormToolbar

N/A

Location corresponds to the edit form toolbar of lists.

 

Microsoft.SharePoint.Administration.ApplicationCreated

Links

Application Created page.

CreateSite

HomePage

Microsoft.SharePoint.Administration.ApplicationManagement

ApplicationSecurity

Application Security section on Central Administration Application Management page.

  • WebPartSecurity

  • SelfService

  • WebApplicationSecurity

  • ManagePolicy

ManageAuthenticationProviders

Microsoft.SharePoint.Administration.ApplicationManagement

ExternalService

  • External Service Connections section on Central Administration Application Management page.

  • OfficialFile

  • HtmlViewer

DocConversion

Microsoft.SharePoint.Administration.ApplicationManagement

SiteManagement

  • SharePoint Site Management section on Central Administration Application Management page.

  • CreateSite

  • DeleteSite

  • SiteUse

  • QuotaDefinition

  • SiteQuota

  • SiteOwners

ListSiteCollections

Microsoft.SharePoint.Administration.ApplicationManagement

WebApplicationConfiguration

  • SharePoint Web Application Management section on Central Administration Application Management page.

  • Extend

  • Unextend

  • Delete

  • ManagedPaths

  • EmailSettings

  • GeneralSettings

  • ManageContentDatabases

  • ManageWebAppFeatures

ListWebApplications

Microsoft.SharePoint.Administration.ApplicationManagement

WorkflowManagement

Workflow Management section on Central Administration Application Management page.

WorkflowManagement

Microsoft.SharePoint.Administration.Operations

BackupRestore

Backup and Restore section on Central Administration Operations page.

  • Backup

  • BackupHistory

  • Restore

BackupStatus

Microsoft.SharePoint.Administration.Operations

DataConfiguration

Data Configuration section on Central Administration Operations page.

  • DefaultDatabase

DataRetrieval

Microsoft.SharePoint.Administration.Operations

GlobalConfiguration

  • Global Configuration section on Central Administration Operations page.

  • RunningJobs

  • JobDefinitions

  • AlternateAccessMappings

  • ManageFarmFeatures

Solutions

Microsoft.SharePoint.Administration.Operations

LoggingAndReporting

Logging and Reporting section on Central Administration Operations page.

  • DiagnosticLogging

UsageAnalysis

Microsoft.SharePoint.Administration.Operations

Security

Security Configuration section on Central Administration Operations page.

  • ServiceAccount

  • Irm

  • Antivirus

  • BlockedFileTypes

AdministrationRoles

Microsoft.SharePoint.Administration.Operations

Topology

Topology and Services section on Central Administration Operations page.

  • FarmServers

  • TopologyServices

  • IncomingEmailServer

  • ApproveDGs

EmailConfiguration

Microsoft.SharePoint.Administration.Operations

Upgrade

Central Administration Operations page.

  • SiteUpgradeStatus

FinalizeUpgrade

Microsoft.SharePoint.ContentTypeSettings

Fields

  • Columns section on Site Collection Content Type page.

  • AddField

  • ReorderFields

Microsoft.SharePoint.ContentTypeSettings

General

  • Settings section on Site Collection Content Type page.

  • ChangeNameDescription

  • ChangeOptionalSettings

  • ChangeWorkflowSettings

  • RemoveContentType

Microsoft.SharePoint.ContentTypeTemplateSettings

Fields

  • Columns section on List Content Type page.

  • AddField

  • ReorderFields

Microsoft.SharePoint.ContentTypeTemplateSettings

General

Settings section on List Content Type page.

  • ChangeNameDescriptionGroup

  • ChangeOptionalSettings

  • ChangeWorkflowSettings

RemoveContentType

Microsoft.SharePoint.Create

WebPages

Web Pages section on Create page.

 

Microsoft.SharePoint.GroupsPage

NewMenu

New menu on site collection People and Groups page.

 

Microsoft.SharePoint.GroupsPage

SettingsMenu

Settings menu on site collection People and Groups page.

 

Microsoft.SharePoint.ListEdit

Communications

Communications section on Customize page for list or document library.

 

Microsoft.SharePoint.ListEdit

GeneralSettings

General Settings section on Customize page for list.

 

Microsoft.SharePoint.ListEdit

Permissions

Permissions and Management section on Customize page for list or document library.

 

Microsoft.SharePoint.ListEdit.DocumentLibrary

GeneralSettings

General Settings section on Customize page for document library.

 

Microsoft.SharePoint.PeoplePage

ActionsMenu

Actions menu on site collection People and Groups page.

 

Microsoft.SharePoint.PeoplePage

NewMenu

New menu on site collection People and Groups page.

 

Microsoft.SharePoint.PeoplePage

SettingsMenu

Settings menu on site collection People and Groups page.

 

Microsoft.SharePoint.SiteSettings

Customization

  • Look and Feel section on Site Settings page.

  • ProjectSettings

  • NavOptions

  • Theme

  • TopNav

  • QuickLaunch

  • SaveAsTemplate

  • ReGhost

Microsoft.SharePoint.SiteSettings

Galleries

  • Galleries section on Site Settings page.

  • MasterPageCatalog

  • ManageCType

  • ManageField

  • SiteTemplates

  • ListTemplates

  • WebParts

  • Workflows

Microsoft.SharePoint.SiteSettings

SiteAdministration

  • Site Administration section on Site Settings page.

  • RegionalSettings

  • LibrariesAndLists

  • WebUsage

  • UserAlerts

  • RSS

  • SrchVis

  • ManageSubWebs

  • ManageSiteFeatures

  • DeleteWeb

Microsoft.SharePoint.SiteSettings

SiteCollectionAdmin

  • Site Collection Administration section on Site Settings page.

  • DeletedItems

  • SiteCollectionUsage

  • Storage

  • ManageSiteCollectionFeatures

  • Hierarchy

  • Portal

Microsoft.SharePoint.SiteSettings

UsersAndPermissions

  • Users and Permissions section on Site Settings page.

  • PeopleAndGroups

  • SiteCollectionAdministrators

  • User

Microsoft.SharePoint.StandardMenu

ActionsMenu

Actions menu in list and document library views.

 

Microsoft.SharePoint.StandardMenu

ActionsMenuForSurvey

Site Actions menu for surveys.

 

Microsoft.SharePoint.StandardMenu

NewMenu

New menu in list and document library views.

 

Microsoft.SharePoint.StandardMenu

SettingsMenu

Settings menu in list and document library views.

 

Microsoft.SharePoint.StandardMenu

SettingsMenuForSurvey

Site Settings links for surveys.

 

Microsoft.SharePoint.StandardMenu

SiteActions

Site Actions menu.

 

Microsoft.SharePoint.StandardMenu

UploadMenu

Upload menu in document library views.

 

Microsoft.SharePoint.User

ActionsMenu

Actions menu on Web site Permissions page.

 

Microsoft.SharePoint.User

NewMenu

New menu on Web site Permissions page.

 

Microsoft.SharePoint.User

SettingsMenu

Settings menu on Web site Permissions page.

 

Microsoft.SharePoint.Workflows

LeftNavBarLinks

Left navigational area on pages for managing workflow.

 

NewFormToolbar

N/A

Location corresponds to the new form toolbar of lists.

 

ViewToolbar

N/A

Location corresponds to the toolbar in list views.

 

http://msdn.microsoft.com/en-us/library/bb802730.aspx

Posted by Shaans | 1 Comments

Install SharePoint (WSS v3) on Windows Vista

Nothing surprising that you said no when someone asked to install WSS (Windows SharePoint Service) on Windows Vista. WSS has a strict restriction of Windows Server 2003 SP1 or Windows Server 2008. However, Bamboo Solution team have developed little hack to WSS installer making it compatible to install on Vista.

Although you have an nice alternate to use Virtual PC you may try not to start or stop it every time you want to see a bit of it.

Notice - Microsoft does not support SharePoint on Vista or recommend it. Try it at own risk. Hot

 

Read full steps document here at Bamboo Solution blog.

http://community.bamboosolutions.com/blogs/bambooteamblog/archive/2008/05/21/how-to-install-windows-sharepoint-services-3-0-sp1-on-vista-x64-x86.aspx

Posted by Shaans | 1 Comments

Power Commands for Visual Studio 2008

image

 

PowerCommands 1.1 is a set of useful extensions for the Visual Studio 2008 adding additional functionality to various areas of the IDE. The source code is included and requires the VS SDK for VS 2008 to allow modification of functionality or as a reference to create additional custom PowerCommand extensions. Visit the VSX Developer Center at http://msdn.com/vsx for more information about extending Visual Studio.

Download PowerComamnds here : http://code.msdn.microsoft.com/PowerCommands

Posted by Shaans | 0 Comments
Filed under:

Things to do with Embedded Edition of SQL Server 2005

Embedded edition of SQL Server that comes part of Microsoft Windows SharePoint Service 3.0 basic installation is left with less documentation. This edition of SQL Server is also called as Windows Internal Database. Here are few things you may like to do with it.

Locating the service instance

Open services management console (services.msc), you should find a instance with name Microsoft##SSEE


Connecting from SQL Server Management Studio

Open management studio (With admin elevated mode in Windows Vista)

Server Name - "\\.\pipe\mssql$microsoft##ssee\sql\query"

Uninstalling

It is perfectly hard to figure out what it takes to completely uninstall the Embedded Edition of SQL Server, of course you can stop and disable the service.

Following steps would help you remove the service completely.

  1. Start -> Run
  2. msiexec /x {CEB5780F-1A70-44A9-850F-DE6C4F6AA8FB} callerid=ocsetup.exe
  3. OK

 

del.icio.us Tags: ,
Posted by Shaans | 1 Comments
Filed under: , ,
More Posts Next page »
 
Page view tracker