Powered By Blogger

Wednesday, September 29, 2010

ASP.NET MVC Hosting - Asynchronous Controller ASP.NET MVC 2.0

ASP.NET MVC 2 introduces asynchronous controllers. An asynchronous controller is just a variation of a standard ASP.NET MVC controller that sets up an asynchronous interaction with the surrounding ASP.NET runtime. In a way, asynchronous controllers are the ASP.NET MVC counterpart of asynchronous pages that we have in Web Forms.

This post touches the ASP.NET MVC async controller.  Its included in the futures library and is available on codeplex. This may become part of ASP.NET MVC 2.  Download and add reference to the "Microsoft.Web.Mvc" dll. Make the following changes in the Global.asax to set the rounte to handle async request.

In the above route the "Index" action on the "Home" controller is mapped to async route.  Note the "MapAsyncRoute" for sync calls you use MapRoute(..).
Have a look at the controller.

namespace AsynPortal.Controllers
{
    public class HomeController : AsyncController
    {
        // The async framework will call this first when it matches the route
        public void Index()
        {
            // Set a default value for our result param
            // (will be passed to the MyActionCompleted method below)           
            // Indicate that we're performing an operation we want to offload
            AsyncManager.OutstandingOperations.Increment(2);
            var client = new WebClient();
            client.DownloadStringCompleted += (s, e) =>
            {
                if (!e.Cancelled && e.Error == null)
                {
                    // We were successful, set the result
                    AsyncManager.Parameters["site1"] = e.Result;
                }
                // Indicate that we've completed the offloaded operation
                AsyncManager.OutstandingOperations.Decrement();
            };
            // Actually start the download
            client.DownloadStringAsync(new Uri("http://geekswithblogs.net/rajeshpillai"));
            var client1 = new WebClient();
            client1.DownloadStringCompleted += (s, e) =>
            {
                if (!e.Cancelled && e.Error == null)
                {
                    // We were successful, set the result
                    AsyncManager.Parameters["site2"] = e.Result;
                }
                // Indicate that we've completed the offloaded operation
                AsyncManager.OutstandingOperations.Decrement();
            };
            // Actually start the download
            client1.DownloadStringAsync(new Uri("http://www.google.com"));
        }
        // This will be called when the outstanding operation(s) have completed
        public ActionResult IndexCompleted(string site1, string site2)
        {
            return View("Index", new PortalViewModel
            {
                Site1 = site1,
                Site2 = site2
            });
        }
    }
}

The above Index() method sets up two asynchronous request.  Evern async method has its "actioncompleted" method also.  In the above case it is "IndexCompleted" method.
The line AsyncManager.OutstandingOperations.Increment(2) sets that two operations will be running in async mode. The IndexCompleted action method is invoked once all the async method is completed execution. The parameters are passed to the IndexCompleted method by
                    AsyncManager.Parameters["site2"] = e.Result;
To indicate that the method completed execution call the
AsyncManager.OutstandingOperations.Decrement() method.
The model is declared below.

namespace Demo.Model

{
    public class PortalViewModel
    {
        public string Site1 { get; set; }
        public string Site2 { get; set; }
    }
}
Hope this post can help you.

Tuesday, September 28, 2010

How to Install ASP.NET Membership Provider on a Shared Hosting Company

You can accomplish this by still using the aspnet_regsql tool provided with the .NET framework. However, there is an option -sqlexportonly that allows you to output the scripts it generates so you can run them directly on the hosting database you do have access to.

Here are the steps:


Open a command prompt and run the aspnet_regsql tool as follows but replacing TestDB with your database name

Command to Create the Add Scripts:
aspnet_regsql -d TestDB -A all -sqlexportonly C:\ASPNET_SQLMembershipProviderTestDB.sql
Command to Create the Remove Scripts:
aspnet_regsql -d TestDB -R all -sqlexportonly C:\ASPNET_SQLMembershipProviderTestDBRemove.sql

Here is a screenshot:

Now you can run the scripts (Add or Remove) as needed for the database you are trying to install this on.

You can visit here to get ASP.NET 4.0 hosting.

Create Applications Using SharePoint

Clients often contact us with the need for Corporate Portal or Website. Usage of Microsoft SharePoint platform is one of the easiest and convenient ways to solve their tasks. In the article we’ll try to briefly describe the powerful tool for creating the similar solutions.
Microsoft SharePoint is a web-oriented platform for collaboration and documents management. The solution can be used to create different web-sites with shared documents or dedicated applications (i.e. Wiki, blogs, forums). SharePoint functionality is presented to the User by control elements that display the data which can also be edited. Such webparts are placed on pages which in turn are placed on the Portal and are available to the User via browser.
1. Windows Sharepoint Services
Windows SharePoint Services (WSS) – is a platform for deployment and content management by Microsoft. WSS has the following features:
- is a basis of files and folders;
- gives basic option for information search;
- gives content management system;
- management of access rights definition;
- gives an option for webpart extension.
After the application deployment the standart or customized webparts can be used. Blogs, private address books, documents store websites, internet shops, news websites, pages with audio and video players can be easily created with the help of the applications. All the above functionality can also be combined on the single portal. Our developers can alter any website component per your requirements.
The Lists can be set up to display various document types in different views as per the User’s specific tasks. Microsoft SQL Server is used as DBMS for applications based on SharePoint.
2. Microsoft Office Sharepoint Server
Microsoft Office SharePoint Server (MOSS) is the best component for integration SharePoint functionality into MS Office applications. It expands Windows SharePoint Services with new options. If a document have to be saved as parts of web-applications, the solution to use is MOSS. Client Office applications (including Word, Excel, Outlook, InfoPath) can be easily used in composition of Corporate solutions, build on SharePoint. All MOSS functions can be extended by our developers for a wide range of products realization: from the simple web-panels to the complex web-applications.
Sharepoint Advantages
SharePoint products and technologies give the wide range of advantages not only for developers, but also for separate users and organizations of any level:
- Full functionality of the portal right after the installation
All SharePoint Server options are available right after the installation. Though the set of Server options is wider and includes news, catalogues, topic areas, private web-sites- “my site”, supposed audience selection, tools for searching and viewing employees, work groups and information as well as web-sites creation that gives the necessary structure for building a single workspace.  SharePoint is based on Microsoft Windows SharePoint Services, that is why tools of Windows SharePoint Services for co-working will be available at once.
- Performance and scalability
SharePoint Server supposes the following flexible means of deployment that provides distributed structure and optimal work of the portal: SharePoint supports server farms creation with distributed task servers, database severs, search option and option of indexation by different external services. Shared Services could provide from the single center and employ on the several portal farms the services like search or support of private web-sites.  Besides SharePoint Server can serve up to 1,000,000 Users simultaneously registered in Active Directory, and it has capacity of 250 pages per second.
- Private sites (“My sites” section)
Private site is a site which may have a private view where User stores data inaccessable to others, i.e. unfinished documents, private pieces of news and weblinks; and a general view where data for other Users is stored, i.e. presentations or finished reports. Information in the general view of private sites can be indexed by Administrator with the help of catalogue services, i.e. Active Directory, which provides Users with an option to search for the information and examples to help them complete their tasks, within all the company.
- Single signon system
Singe signon allows the users to receive personal data from any system part with just a single login to the system. When Users login the portal, SharePoint saves User data in a secure place. When the portal applications require information from other business-applications, i.e. system of planning company resourses, CRM system of third-party providers, SharePoint uses User data with verifying them in Active Directory. So the User doesn’t need to login into external business-application.
- Flexibility, personalization, adaptation of web-component based pages.
SharePoint provides additional web-components and flexible means of their management, which allow Users to set up portal pages in the necessary way with simple drag-and-drop of the components to the page. In Microsoft Office FrontPage there is a complete support of web-components and web-component based pages including adding, editing and setting up of web-components, web-components zone and differents web-component pages;
- Subject parts
SharePoint provides for subject sorting, which is highly intuitive when searching for survey of random data from documents and people information to web-sites on base of Windows. A document or link can be refered to several subjects, subject parts may contain documents stored in SharePoint, as well as links to the information from outher sources. Management policy has hierarchical distributed structure that allows experts in this field to create and maintain the most favourable parts.
- Active Directory untegration with Microsoft Office products
SharePoint scan through Active Directory catalogues, gathering User data. Users can manage information about them in the portal and get alerts when other Users publish or change information.
SharePoint makes Users’ work more comfortable regardless of the application they use. The User can create and maintain web-sites, i.e. website of the document working area, add news and events to SharePoint web-sites on the portal and get alerts with the help of web-browser.
- Search
SharePoint allows Users to search by key words in the whole text and in the document properties. Users can search for not only the information, but also other people, work groups and web-sites of the portal.
- Key features of Windows SharePoint Services
Private websites, workgroup websites and subject areas of the SharePoint portal has all the features of Windows SharePoint Services document libraries, supporting version alert, simple routing and confirmation mechanism. Users can check in and check out documents or return to previous document versions using their usual applications.
SharePoint provides a wide range of calendar events, advertisements, links, tasks and also an option to define new lists (which serves as a flexible tool for different tasks solving). Additionally SharePoint provides with web-sites creation, uses meeting web-sites and document workspace right from the applications of Microsoft Office group. The websites created with the help of checked templates make it easier to conduct discussion and meetings, improving co-working of the work groups and companies.
Besides SharePoint provides a list of additional facilities:
a. Has a custom design option;
b. Has an option of IE, FireFox, Safari, Opera browsers usage;
c. Has wide  options of User rights distribution;
d. Has a high safety level of the data transfer.
3. Creating Applications Using Sharepoint
Process of web-application development using SharePoint is similar to the process of application development using more traditional means (i.e. PHP).  Nevertheless, product development stage goes much faster and as a result cheaper to the Client.
Simplified process of web-applications creation with the use of SharePoint can be given with the following set of actions:
- SharePoint deployment and web-site creation by default;
- After Windows SharePoint Services deployment the web-site is created by default;
- Web-sites collection for the application with a template is created by default;
- Then there is a creation of the necessary types, lists and user groups;
- User rights are defined for the lists. The full safety of User information is provided.
- Necessary application components (i.e. wikis, blogs, calendars, etc.) are added and set up.
- Web-site interface is setup per Client’s wishes.
Using the action sequence, our developers can shortly create  web-applications starting from Corporate web-sites to internet-portals with wide functionality.
Note: SharePoint is a powerful tool which enables creation of web-sites and a big number of applications that use.