Suresh Behera

The Microsoft .Net Junkies

News

Blogroll

Reading

ASP.NET 2.0 : Frequently Asked Questions

General Questions on ASP.NET 2.0

  • Do I need IIS to run Web applications?
    If you are using Visual Studio, you can use the ASP.NET Development Server built into Visual Studio to test your pages. The server functions as a local Web server, running ASP.NET Web pages in a manner virtually identical to how they run in IIS. To deploy a Web application, you need to copy it to a computer running IIS version 5 or 6.
  • How do I create pages for mobile devices?
    ASP.NET will automatically detect the type of browser making the request. This information is used by the page and by individual controls to render appropriate markup for that browser. You therefore do not need to use a special set of pages or controls for mobile devices. (Whether you can design a single page to work with all types of browsers will depend on the page, on the browsers you want to target, and on your own goals.)
  • Are ASP.NET pages XHTML compatible?
    Yes. Individual controls render markup that is compatible with the XHTML 1.1 standard. It is up to you, however, to include the appropriate document type declaration and other XHTML document elements. ASP.NET does not insert elements for you to ensure XHTML compatibility. For details, see ASP.NET and XHTML Compliance.
  • Can I hide the source code for my page?
    Server-side code is processed on the server and is not sent to the browser, so users cannot see it. However, client script is not protected; any client script that you add to your page, or that is injected into the page by server processing, is visible to users. If you are concerned about protecting your source code on the server, you can precompile your site and deploy the compiled version. For details, see Publishing Web Sites.
  • When I run a page, I get the error "The page cannot be displayed" and an HTTP 502 Proxy Error. Why?
    This error can occur if you are running ASP.NET Web pages using the Visual Web Developer Web server, because the URL includes a randomly selected port number. Proxy servers do not recognize the URL and return this error. To get around the problem, change your settings in Internet Explorer to bypass the proxy server for local addresses, so that the request is not sent to the proxy. In Internet Explorer, you can make this change in Tools > Internet Options. In the Connections tab, click LAN Settings and then select Bypass proxy server for local addresses.
  • Which page code model is preferable, single-file or code-behind?
    Both models function the same and have the same performance. The choice of using single-file pages versus code-behind pages is one of personal preference and convenience. For details, see ASP.NET Web Page Code Model.
  • The QuickStart examples and examples in the API reference seem to use single-file pages frequently. Does this mean that single-file is the preferred model for pages?
    No. Single-file pages are frequently used in examples because they are easier to illustrate — the writer does not have to create a separate file to show the code.
  • Is it better to write code in C# or Visual Basic?
    You can write code for your Web application in any language supported by the .NET Framework. That includes Visual Basic, C#, J#, JScript, and others. Although the languages have different syntax, they all compile to the same object code. The languages have small differences in how they support different features. For example, C# provides access to unmanaged code, while Visual Basic supports implicit event binding via the Handles clause. However, the differences are minor, and unless your requirements involve one of these small differences, the choice of programming language is one of personal preference. Once programs are compiled, they all perform identically; that is, Visual Basic programs run just as fast as C# programs, since they both produce the same object code.
  • Do I have to use one programming language for all my Web pages?
    No. Each page can be written in a different programming language if you want, even in the same application. If you are creating source code files and putting them in the \Code folder to be compiled at run time, all the code in must be in the same language. However, you can create subfolder in the \Code folder and use the subfolders to store components written in different programming languages.
  • Is the code in single-file and code-behind pages identical?
    Almost. A code-behind file contains an explicit class declaration, which is not required for single-file pages.
  • Is the old code-behind model still supported?
    Old projects will continue to run without change. In Visual Studio 2005, if you open a project created in Visual Studio .NET 2002 or 2003, the project is converted to the new project layout used in Visual Studio 2005. As part of the conversion, pages that use the old code-behind model are converted to use the new code-behind model. You cannot create pages using the old code-behind model in Visual Studio 2005.
Questions on ASP.NET 2.0 Controls

  • Why is there no DataGrid control on the Toolbox?
    The DataGrid control has been superseded by the GridView control, which can do everything the DataGrid control does and more. The GridView control features automatic data binding; auto-generation of buttons for selecting, editing, and deleting; automatic sorting; and automatic paging. There is full backward compatibility for the DataGrid control, and pages that use the DataGrid will continue to work as they did in version 1.0 of ASP.NET.
  • Can I still use the DataList and Repeater controls?
    Absolutely. You can use them the way you always have. But note that the controls have been enhanced to be able to interact with data source controls and to use automatic data binding. For example, you can bind a DataList or Repeater control to a SqlDataSource control instead of writing ADO.NET code to access the database.
  • What's the difference between login controls and Forms authentication?
    Login controls are an easy way to implement Forms authentication without having to write any code. For example, the Login control performs the same functions you would normally perform when using the FormsAuthentication class — prompt for user credentials, validate them, and issue the authentication ticket — but with all the functionality wrapped in a control that you can just drag from the Toolbox in Visual Studio. Under the covers, the login control uses the FormsAuthentication class (for example, to issue the ticked) and ASP.NET membership (to validate the credentials). Naturally, you can still use Forms authentication yourself, and applications you have that currently use it will continue to run.
 

Configuring ASP.NET 2.0


 

Questions on Visual Web Developer

More.. http://msdn.microsoft.com/asp.net/beta2/faq/default.aspx

Suresh Behera

Comments

Alkesh said:

Great article and nicely done.

thanks for taking time to answering a few of the ASP.NET questions.

# August 14, 2008 2:30 AM