Web developer 2010 microsoft




















By Scott Hanselman July Visual Studio SP1 was released in March. This service pack addresses issues found by customers in partner feedback and internal testing. At the same time Visual Studio SP1 was released, a number of new components for Web developers came out. Other improvements include support for bin-deployable dependencies such as ASP.

This article assumes that you have Visual Studio SP1 installed. It can be downloaded as a standalone installer or using the Web PI. Details on where to get it can be found at bit.

More details can be found at bit. IIS Express 7. There are various ways to download and install the components. There are a few hard ways, and the easy way. You could look for and download each standalone component on your own. Perhaps this would be appropriate for an enterprise or controlled deployment of Visual Studio SP1. You can use the Web PI to find, download and install each package separately, which is useful if you only want certain features. The Web PI is smart about what you have on your machine.

If you have literally nothing—no development tools—on your machine, this link will automatically install the free Visual Studio Web Developer Express SP1 and all the new features.

However, if you have any version of Visual Studio already installed, or even if you have Visual Studio SP1 and some of the tools, the Web PI will automatically get just the minimum you need to be up-to-date. Missing component dialog This is a new dialog introduced in the service pack. This dialog comes up when you open an existing Web project that uses IIS 7. Windows Users' choice Visual web developer download Visual web developer download Most people looking for Visual web developer downloaded: Microsoft Visual Web Developer Express.

NET Component Pack. Info I Starter Kit. How to improve Google Chrome performance. How to make a website for free. How to clear cache.

How to manage a blog with Wordpress Secrets. How to stop Apple software update notifications on your Mac. There are two main approaches for using the new ASP. NET browser capabilities definition functionality, or totally replacing it. The following sections describe first how to replace the functionality, and then how to extend it.

To replace the ASP. NET browser capabilities definition functionality completely, follow these steps:. Create a provider class that derives from HttpCapabilitiesProvider and that overrides the GetBrowserCapabilities method, as in the following example:. The code in this example creates a new HttpBrowserCapabilities object, specifying only the capability named browser and setting that capability to MyCustomBrowser. In order to use a provider with an application, you must add the provider attribute to the browserCaps section in the Web.

You can also define the provider attributes in a location element for specific directories in application, such as in a folder for a specific mobile device. The following example shows how to set the provider attribute in a configuration file:. Another way to register the new browser capability definition is to use code, as shown in the following example:.

Any change to the BrowserCapabilitiesProvider class must occur before any code in the application executes, in order to make sure that the cache remains in a valid state for the resolved HttpCapabilitiesBase object. The preceding example has one problem, which is that the code would run each time the custom provider is invoked in order to get the HttpBrowserCapabilities object. This can happen multiple times during each request.

In the example, the code for the provider does not do much. However, if the code in your custom provider performs significant work in order to get the HttpBrowserCapabilities object, this can affect performance. To prevent this from happening, you can cache the HttpBrowserCapabilities object.

Follow these steps:. Create a class that derives from HttpCapabilitiesProvider , like the one in the following example:. In the example, the code generates a cache key by calling a custom BuildCacheKey method, and it gets the length of time to cache by calling a custom GetCacheTime method.

The code then adds the resolved HttpBrowserCapabilities object to the cache. The object can be retrieved from the cache and reused on subsequent requests that make use of the custom provider. NET 4.

You can also extend the ASP. NET browser capabilities functionality by adding new browser capabilities definitions to those that are already in ASP. You can do this without using the XML browser definitions. The following procedure shows how. Create a class that derives from HttpCapabilitiesEvaluator and that overrides the GetBrowserCapabilities method, as shown in the following example:. This code first uses the ASP. NET browser capabilities functionality to try to identify the browser.

However, if no browser is identified based on the information defined in the request that is, if the Browser property of the HttpBrowserCapabilities object is the string "Unknown" , the code calls the custom provider MyBrowserCapabilitiesEvaluator to identify the browser.

In addition to creating a custom browser definition provider and to dynamically creating new browser definitions, you can extend existing browser definitions with additional capabilities. This lets you use a definition that is close to what you want but lacks only a few capabilities. To do this, use the following steps. The example code extends the existing ASP. NET HttpCapabilitiesEvaluator class and gets the HttpBrowserCapabilities object that matches the current request definition by using the following code:.

The code can then add or modify a capability for this browser. There are two ways to specify a new browser capability:. In the previous example, the code adds a capability named MultiTouch with a value of true.

Set existing properties of the HttpCapabilitiesBase object. In the previous example, the code sets the Frames property to true. This property is simply an accessor for the IDictionary object that is exposed by the Capabilities property. Note This model applies to any property of HttpBrowserCapabilities , including control adapters. NET 4 adds built-in support for using routing with Web Forms. Routing lets you configure an application to accept request URLs that do not map to physical files.

Instead, you can use routing to define URLs that are meaningful to users and that can help with search-engine optimization SEO for your application. For example, the URL for a page that displays product categories in an existing application might look like the following example:.

By using routing, you can configure the application to accept the following URL to render the same information:. Routing has been available starting with ASP. NET 3. For an example of how to use routing in ASP.

However, ASP. NET 4 includes some features that make it easier to use routing, including the following:. The following example is equivalent to the SearchRoute definition shown in the previous example, but uses the PageRouteHandler class.

The first route definition also specifies that the parameter named searchterm should be extracted from the URL and passed to the page. The checkPhysicalUrlAccess parameter specifies whether the route should check the security permissions for the physical page being routed to in this case, search. These permissions are defined in the Web. In the example configuration, access is denied to the physical page search. In the code of the Web Forms physical page, you can access the information that routing has extracted from the URL or other information that another object has added to the RouteData object by using two new properties: HttpRequest.

RequestContext and Page. RouteData wraps HttpRequest. The following example shows how to use Page. The code extracts the value that was passed for the searchterm parameter, as defined in the example route earlier. Consider the following request URL:. When this request is made, the word "scott" would be rendered in the search. The method described in the previous section shows how to get route data in code in a Web Forms page.

You can also use expressions in markup that give you access to the same information. Expression builders are a powerful and elegant way to work with declarative code. NET 4 includes two new expression builders for Web Forms routing. The following example shows how to use them. This saves you from having to hard-code the complete URL into the markup, and lets you change the URL structure later without requiring any change to this link.

NET automatically works out the correct route that is, it generates the correct URL based on the input parameters. You can also include a route name in the expression, which lets you specify a route to use.

When the page that contains this control runs, the value "scott" is displayed in the label. The RouteValue expression makes it simple to use route data in markup, and it avoids having to work with the more complex Page.

RouteData["x"] syntax in markup. The RouteParameter class lets you specify route data as a parameter value for queries in a data source control. It works much like the class, as shown in the following example:.

In this case, the value of the route parameter searchterm will be used for the companyname parameter in the Select statement. NET, namely how controls create the id attribute for elements that they render. Knowing the id attribute for rendered elements is important if your application includes client script that references these elements. Until ASP. NET 4, the algorithm for generating the id attribute from the ClientID property has been to concatenate the naming container if any with the ID, and in the case of repeated controls as in data controls , to add a prefix and a sequential number.

While this has always guaranteed that the IDs of controls in the page are unique, the algorithm has resulted in control IDs that were not predictable, and were therefore difficult to reference in client script. You can set the ClientIDMode property for any control, including for the page. Possible settings are the following:. You can set the ClientIDMode property at the page level.

This defines the default ClientIDMode value for all controls in the current page. As a result, if you do not set this property anywhere in your code, all controls will default to the AutoID algorithm. You set the page-level value in the Page directive, as shown in the following example:. You can also set the ClientIDMode value in the configuration file, either at the computer machine level or at the application level.

This defines the default ClientIDMode setting for all controls in all pages in the application. If you set the value at the computer level, it defines the default ClientIDMode setting for all Web sites on that computer. The following example shows the ClientIDMode setting in the configuration file:. As noted earlier, the value of the ClientID property is derived from the naming container for a control's parent.

In some scenarios, such as when you are using master pages, controls can end up with IDs like those in the following rendered HTML:. Even though the input element shown in the markup from a TextBox control is only two naming containers deep in the page the nested ContentPlaceholder controls , because of the way master pages are processed, the end result is a control ID like the following:. This ID is guaranteed to be unique in the page, but is unnecessarily long for most purposes.

Imagine that you want to reduce the length of the rendered ID, and to have more control over how the ID is generated. For example, you want to eliminate "ctlxxx" prefixes. The easiest way to achieve this is by setting the ClientIDMode property as shown in the following example:. These settings result in the following markup the rest of the page and the master page is assumed to be the same as in the previous example :. The name attribute of rendered elements is unaffected, so the normal ASP.

NET functionality is retained for events, view state, and so on. A side effect of resetting the naming hierarchy is that even if you move the markup for the NamingPanel elements to a different ContentPlaceholder control, the rendered client IDs remain the same. Note It is up to you to make sure that the rendered control IDs are unique. If they are not, it can break any functionality that requires unique IDs for individual HTML elements, such as the client document.

The ClientID values that are generated for controls in a data-bound list control by the legacy algorithm can be long and are not really predictable. The ClientIDRowSuffix property can be used only in data-bound controls, and its behavior differs depending on which control you are using. The differences are these:. GridView control — You can specify the name of one or more columns in the data source, which are combined at run time to create the client IDs.

ListView control — You can specify a single column in the data source that is appended to the client ID. In a Repeater control, the index of the current row is used. The GridView and ListView controls can let users select a row. NET, selection has been based on the row index on the page. For example, if you select the third item on page 1 and then move to page 2, the third item on that page is selected.

Persisted selection was initially supported only in Dynamic Data projects in the. NET Framework 3. When this feature is enabled, the current selected item is based on the data key for the item.

This means that if you select the third row on page 1 and move to page 2, nothing is selected on page 2. When you move back to page 1, the third row is still selected. Persisted selection is now supported for the GridView and ListView controls in all projects by using the EnablePersistedSelection property, as shown in the following example:. NET Chart control expands the data-visualization offerings in the. Using the Chart control, you can create ASP.

NET pages that have intuitive and visually compelling charts for complex statistical or financial analysis. NET Chart control was introduced as an add-on to the. NET Framework version 3. NET Framework 4 release. The following figures show examples of financial charts that are produced by the ASP. NET Chart control. For more examples of how to use the ASP.

You can find more samples of community content at the Chart Control Forum. The following example shows how to add a Chart control to an ASP.

NET page by using markup. In the example, the Chart control produces a column chart for static data points. The Chart control contains a ChartAreas collection, which can contain ChartArea objects that define characteristics of chart areas.

For example, to use 3-D for a chart area, use the Area3DStyle property as in the following example:. Scale breaks and logarithmic scales are two additional ways to add sophistication to the chart. These features are specific to each axis in a chart area. For example, to use these features on the primary Y axis of a chart area, use the AxisY.

The following snippet shows how to use scale breaks on the primary Y axis. A very common task for developers who create data-driven Web pages is to filter data. This traditionally has been performed by building Where clauses in data source controls. This approach can be complicated, and in some cases the Where syntax does not let you take advantage of the full functionality of the underlying database. This control can be added to EntityDataSource or LinqDataSource controls in order to filter the data returned by these controls.

Because the QueryExtender control relies on LINQ, the filter is applied on the database server before the data is sent to the page, which results in very efficient operations. The QueryExtender control supports a variety of filter options. The following sections describe these options and provide examples of how to use them. For the search option, the QueryExtender control performs a search in specified fields.

In the following example, the control uses the text that is entered in the TextBoxSearch control and searches for its contents in the ProductName and Supplier. CompanyName columns in the data that is returned from the LinqDataSource control. The range option is similar to the search option, but specifies a pair of values to define the range. In the following example, the QueryExtender control searches the UnitPrice column in the data returned from the LinqDataSource control.

The property expression option lets you define a comparison to a property value. If the expression evaluates to true , the data that is being examined is returned.

In the following example, the QueryExtender control filters data by comparing the data in the Discontinued column to the value from the CheckBoxDiscontinued control on the page. Finally, you can specify a custom expression to use with the QueryExtender control. This option lets you call a function in the page that defines custom filter logic. The following example shows how to declaratively specify a custom expression in the QueryExtender control.

The following example shows the custom function that is invoked by the QueryExtender control. In this case, instead of using a database query that includes a Where clause, the code uses a LINQ query to filter the data. These examples show only one expression being used in the QueryExtender control at a time.

However, you can include multiple expressions inside the QueryExtender control. Some ASP. This syntax uses HTML encoding by default when writing to the response. This new expression effectively translates to the following:. The goal of this feature is to make it possible to replace all instances of the old syntax with the new syntax so that you are not forced to decide at every step which one to use.

However, there are cases in which the text being output is meant to be HTML or is already encoded, in which case this could lead to double encoding. For those cases, ASP. Instances of these types let you indicate that the return value is already properly encoded or otherwise examined for displaying as HTML, and that therefore the value should not be HTML-encoded again.

For example, the following should not be and is not HTML encoded:. This new syntax does not work when you run an application using ASP. Keep in mind that this does not guarantee protection from XSS attacks. For example, HTML that uses attribute values that are not in quotation marks can contain user input that is still susceptible. Note that the output of ASP.

NET MVC helpers always includes attribute values in quotation marks, which is the recommended approach. Likewise, this syntax does not perform JavaScript encoding, such as when you create a JavaScript string based on user input. Visual Studio also supports an Empty Web Site project type, which contains no files at all, as shown in the following figure:. The result is that for the beginner, there is very little guidance on how to build a production Web application.

Therefore, ASP. NET 4 introduces three new templates, one for an empty Web application project, and one each for a Web Application and Web Site project. You select this project template from the Visual Studio New Project dialog box, as shown in the following figure:.

Click to view full-size image. When you create an Empty ASP. NET, with one exception. Without this targetFramework property, Visual Studio defaults to targeting the. NET Framework 2. The other two new project templates that are shipped with Visual Studio contain major changes. The following figure shows the project layout that is created when you create a new Web Application project.

The layout for a Web Site project is virtually identical. The project includes a number of files that were not created in earlier versions. In addition, the new Web Application project is configured with basic membership functionality, which lets you quickly get started in securing access to the new application. Because of this inclusion, the Web. The following example shows the Web. In this case, roleManager is disabled. The project also contains a second Web.

The second configuration file provides a way to secure access to the ChangePassword. The following example shows the contents of the second Web. The pages created by default in the new project templates also contain more content than in previous versions. The project contains a default master page and CSS file, and the default page Default.

The result is that when you run the Web application or Web site for the first time, the default home page is already functional.



0コメント

  • 1000 / 1000