Thursday 30 June 2011

ASP.Net faq 2

Question:

Is it possible to share a cache object across servers in a cluster?

Answer:
The Cache object is restricted to being used only within an application running on a single machine. Microsoft concluded that the performance hit to share the objects cross-process would be too great to share it across multiple machines in a cluster (because -- unlike session state -- there are no logical synchronization boundaries to lock across).

Question:
Can session variables be accessed from code-behind?

Answer:
Yes. You can access the "Session" dictionary within a code-behind file just like you would if you were accessing it from within an line .aspx file.

For example: Session("Name") = "Scott"

Question:
What is being passed back and forth in the _ViewState form control?

Answer:
The __VIEWSTATE hidden field is used to transfer the differences in controls from what is declared in the page -- and the values they contain at the end of a request immediately prior to rendering. We can then use this information to re-construct the server controls to match that last rendered state during "postbacks" to a page.

The information within the __VIEWSTATE field is not really encrypted -- although the values are definitely "cyptic" to read (mainly because server controls try to store information in as compact a format as possible -- and because our serializer performs some limited compression).

You can see how much viewstate each control is saving by enabling tracing for the page. For example, by adding a trace attribute to the page directive:



This will cause a table to be output at the bottom of the page. This won't show the exact values stored in viewstate -- but will give you a rough estimate of the size of each server control value.

Note that you can disable the viewstate feature -- either for the entire page or on specific server controls. This is done at the page level by setting the following page directive:


or on an individual server control by setting a "maintainstate" attribute:


Question:
How do I setup web farm session state to use SQL Server?

Answer:
Run the ASP.NET Session State SQL Script to create the appropriate tables within a SQL Server database. Then modify your application's config.web file to point to this database. ASP.NET will then, under the covers, handle serializing your state from the Session intrinsic to/from the database.

Question:
What new ways are there to handle session state in a web cluster?

Answer:
There are two new methods of handling session state in a web cluster.

The first method is to designate one server as a "state server" by enabling the state service on it. This server can then be the central store of state information for the entire cluster.

Another option is to persist the state information directly to a SQL Server database. This not only gives you a shared, central store for state information but also allows you to retain state information in case of a failure or server reboot.

Question:
How well does the ASPState perform when stored in SQL Server?

Answer:
The target performance for the full release of ASP.Net will be 75-80% of the performance seen by using in-process state management.

Question:
Is there a way to directly query session data if a SQL Server StateStore is being used?

Answer:
The session data is encrypted but the creation date, expiration date,

session id, and timeout are all directly available.

Question:
Is it ok to save a dataset in Page ViewState?

Answer:
Scott Guthrie from Microsoft recommends that you avoid putting a DataSet into Page ViewState. The downside with this is that doing so can drastically increase the size of ViewState that is posted back and forth between round-trips. This can end up making a big performance difference when connecting to the application

over slow network connections (since you end up having to transmit a lot more data each way).

Instead, if you need to save the DataSet across requests, I'd recommend storing it in Session state. ASP.NET now supports web farm session state -- meaning you will no longer need to worry about being tied down to a single machine in this scenario.

Question:
Do web services support session variables and/or cookies?

Answer:
From Scott Swigart @ 3 Leaf Solutions, LLC:

It appears that in Beta 2, a web service client will not store cookies by

default (which means that Web Services that use sessions won't work). If

you want the client to support cookies, then you have to do the following:

using System.Net

wsAdv.Stateful s = new wsAdv.Stateful();

s.CookieContainer = new CookieContainer();

s.DoSomething();



Question:
Will I be able to use Output Caching and Web Farm Session State on Windows Standard edition?

Answer:
Yes. Output Caching and Web Farm Session state will be ASP.NET features that work on Windows Window Server Standard, Windows Advanced Server and Windows DataCenter Server editions.

What is the .NET Framework?
The .NET Framework is an environment for building, deploying, and running Web Services and other applications. It consists of three main parts: the Common Language Runtime, the Framework classes, and ASP.NET.

What kind of applications we can build using the .NET Framework?
The .NET Framework enables you to create great Web applications. However, it can also help you build the same applications you build today. If you write any Windows software (using ATL/COM, MFC, Microsoft(r) Visual Basic(r), or even standard Microsoft(r) Win32(r)), .NET offers many advantages to the way you currently build applications. Of course, if you do develop Web sites, then the .NET Framework has a lot to interest you-starting with ASP.NET.

How is ASP.NET different than ASP 3.0?
ASP.NET is a completely new ASP. It was written entirely from the ground up (homage to Scott Guthrie and Mark Anders for their ingenious idea) in C# (pronounced 'see sharp'). ASP.NET makes use of compilable programming languages, such as Visual Basic.Net, C#, even COBOL! (making it truely language-neutral), to write Web Applications. The applications are compiled on the server, and pages are served in HTML for the specific browser that has issued the request

What do I need to run ASP.NET?
To run ASP.NET, you must have the .NET Framework SDK. This beta software should only be installed on non-production test machines. The SDK will run on Windows(r) 2000 and Windows NT(r) 4.0 (including the NTOP for ASP.NET support), Windows 98, or Windows ME. Internet Explorer 5.5 and Data Access Components 2.6 are required.

Do I need to Visual Studio.Net in develop ASP.NET applications?
The command line compilers for VB, C# and JScript will ship with ASP.NET in addition to VS.Net. This means that you don't have to purchase/install VS.Net in order to write components with ASP.NET. You can simply install the "SDK" version of ASP.NET that will be available publicly on the Microsoft.com website and go from there. ASP.NET and the .NET Frameworks will not cost money. You will be able to download them, install them, and use them on both development and deployment servers for free

Is ASP.NET cross-browser compatible?
ASP.NET will provide multiple types of HTML depending on the browser. 'UpLevel' browsers (IE4.0+) will get HTML4.0 and Client-Side JavaScript 1.0. All other browsers ('DownLevel') will get HTML3.2 and no JavaScript. That is as of Beta 1

What platform(s) will ASP.NET run on?
Once released, you will be able to run ASP.NET on either IIS5 or IIS4 (we will not require a new version of IIS to install it). Because we run side-by-side with ASP (meaning both can run concurrently on the same box -- so your existing apps won't break at all), there shouldn't be any real adoption blockers to installing it.

You can use VS6 to edit ASP.NET Applications. Or you can use notepad. Or you can use VS7 (which has WYSIWYG Designers and Debuggers for VB, C# and C++ that target ASP.NET)

Different Errors at ASP.NET :
Welcome to the "unofficial" ASP.NET Frequently Asked Questions (FAQ) web page. These FAQs are from the Microsoft ASP.NET Newsgroup and are compiled by Carl Prothman, a Microsoft ASP.NET MVP.

Do you know of an ASP.NET FAQ which is not listed here? If so, please email to Carl Prothman and he will add it to this FAQ web page.

No comments:

Post a Comment