No. Though in production environment IIS is used, at the time of development, you
can test your applications using ASP.NET Development Server, which is provided by
Microsoft along with Visual Studio.NET and Visual Web Developer.
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 (Intermediate Language).
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.
6. What is postback?
7. What is viewstate?
Asp.net 2.0 provides diffent folder for diffrent purposes. The following table shows
commonly used folders.
Folder Description
App_Code Contains all .cs or .vb files. Basically it contains code files
App_Data Contains data files like .MDF files
App_themes Contains themes created in the project
But, if you are creating source code files and putting them in the \App_Code folder to
be compiled at run time, all the code in must be in the same language.
However, you can create subfolders in the \App_Code folder and use subfolders to
store components written in different programming languages.
Single file .aspx is where both the content and page are placed in a single .aspx file.
Two file .aspx is where content (tags) is placed in .aspx file and code is placed in
.aspx.cs or .aspx.vb file.
No.
Most browsers recognize the following META tag as a signal to automatically refresh
the page every nn seconds:
<meta http-equiv="Refresh" content="nn">
nn is number of seconds.
response.appendheader("refresh",10)
13. How can an ASP.NET application determine whether cookies are
enabled in a browser?
Determining whether cookies are enabled requires a round trip to the browser and
back. The basic strategy is to return a cookie in an HTTP response and redirect to a
page that checks for the cookie.
<%
' Page1.aspx
dim c as new HttpCookie("c1", "v1")
Response.Cookies.Add (cookie)
Response.Redirect ("page2.aspx")
%>
<%
' page2.aspx
dim c as HttpCookie
c = Request.Cookies("c1")
if c is nothing or c.value <> "v1" then
Response.Write ("Cookies are not enabled")
else
Response.Write ("Cookies are enabled")
%>
14. How can ASP.NET application transmit data from one page to another?
One way to transfer data from page to page is to use querystring as follows:
<%
' Page1.aspx
dim st as string = "somevalue"
response.redirect("page2.aspx?value=" & st)
%>
<%
''page2.aspx
dim st as string
st = request.querystring("value")
%>
Another ways is to store data in SESSION variable. The following code shows it:
<%
'' Page1.aspx
dim st as string = "somevalue"
session("value") = st
response.redirect("page2.aspx")
%>
<%
''page2.aspx
dim st as string
st = session("value")
%>
With a little help from a <div> tag, yes. The following ASPX file displays scrolling
table:
<script runat=server>
</script>
<html>
<body>
<form runat="server">
<div style="height: 256px; overflow: auto">
<asp:GridView ID="gv1" Width="100%" RunAt="server" />
</div>
</form>
</body>
</html>
16. Is there any limit for query string? if means what is the maximum size?
Yes. But, it depends on browser. Generally 255 bytes. However it all depends on
browser and os.
The settings made in the web.config file are applied to that particular web application
only whereas the settings of machine.config file are applied to all asp.net
applications on the system.
20. What are the methods you have to send control from one page to
another
From end-user's perspective, the url doesn't change in browser for Server.Transfer()
but it does for Response.Redirect().
You can read, create, or modify configuration settings from within an ASP.NET
application by using the ASP.NET management API. You can develop your own
applications including Web applications, console applications, and scripts that use the
management API. One of the classes in management API is
WebConfigurationManager.
23. How do you ensure that user selects an option in a dropdown list?
An asp.net application is a virtual directory that you make on a web server. This
application will take the settings of machine.config file if a web.config file is not
available in that directory. Now if you create a sub directory inside a virtual directory
and place another web.config file in the sub directory then the sub directory will take
the settings of the web.config file in that particular directory.
25. What do you do if you have a few pages in your application that do not
require authentication?
Assume you have register.aspx and forgotpassword.aspx file which do not require
any authentication. But the rest of the pages in the application should be accessible
only to authenticated users.
<configuration>l
<appSettings/>l
<connectionStrings/>l
<system.web>l
<authorization>l
<allow users="*"/>l
</authorization>l
</system.web>l
</configuration>l
End Class
When you set the value of the AutoEventWireup attribute to false, you must
manually hook up events to event handlers. When you set the value of the
AutoEventWireup attribute to true, the ASP.NET page framework can automatically
raise events.
If the value of the AutoEventWireup attribute is set to false, you must override the
OnInit function, and then you must add a new delegate for Page_Load event handler
explicitly.
AutoEventDemo.aspx
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" Text="Button"
OnClick="Button1_Click" />
</div>
</form>
</body>
</html>
AutoEventDemo.aspx.cs
using System;
}
protected void Button1_Click(object sender, EventArgs e)
{
Response.Write("You Clicked On Button");
}
}
If performance is a key consideration, do not set the value of the AutoEventWireup
attribute to true. The AutoEventWireup attribute requires the ASP.NET page
framework to make a call to the CreateDelegate function for every ASP.NET Web
Form page. Instead of using automatic hookup, you must manually override the
events from the page.
For example FileUpload control's SaveAs() method expects physical path so the
following converts virtual path to physical path.
FileUpload1.SaveAs( Request.MapPath("photos/logo.jpg"));