Samsung Electronics Most Frequently Asked Latest ASP.NET Interview Questions Answers
How To Make Vs.net Use Flowlayout As The Default Layout Rather Than The Gridlayout?
For VB.NET, go to path C:Program Files Microsoft Visual Studio .NET Vb7 VBWizards WebForm Templates 1033
Change the following line in the existing WebForm1.aspx
<body MS_POSITIONING="[!output DEFAULT_HTML_LAYOUT]">to
For C#, go to path C: Program Files Microsoft Visual Studio .NET 2003 VC# VC# Wizards CSharp WebApp Wiz Templates 1033
Change the following line in the existing WebForm1.aspx
<body MS_POSITIONING="[!output DEFAULT_HTML_LAYOUT]">to
Note:Before changing any templates it's a good idea to make backup copies of them Or rather than above approach you can change the behavior for new files on a per project basis in Visual Studio by
Right clicking on the project name (Ex: "WebApplication1)" in Solution Explorer, and select "Properties".
From project properties window, under Common Properties>Designer Defaults>Page Layout change "Grid" to "Flow".
Can I Use A Datareader To Update/insert/delete A Record?
No.
DataReader provides a means of reading a forward-only stream of rows from a database.
How To Format A Telphone Number In The Xxx-xxx-xxxx Format?
VB.NET
Dim Telno As Double = Double.Parse(ds.Tables(0).Rows(0)("TelNo"). ToString())
Response.Write(Telno.ToString("###-###-####"))
C#
double Telno= double.Parse(ds.Tables[0].Rows[0]["TelNo"]. ToString());
Response.Write(Telno.ToString("###-###-####"));
Can Two Different Programming Languages Be Mixed In A Single Aspx File?
No.
ASP.NET uses parsers to strip the code from ASPX files and copy it to temporary files containing derived Page classes, and a given parser understands only one language.
Can I Use Custom .net Data Types In A Web Form?
Yes.
Place the DLL containing the type in the application root's bin directory and ASP.NET will automatically load the DLL when the type is referenced. This is also what happens when you add a custom control from the toolbox to your web form.
How Can I Have A Particular Web Page In An Asp.net Application Which Displays Its Own Error Page?
This can be done by setting the ErroPage attribute of Page Directive or ErrorPage property of Page Class to the desired Custom Error Page
<%@Page Language="C#" ErrorPage="specificerropage.htm"%>
In web.config
<customErrors mode="On" />
Describe The Role Of Inetinfo.exe, Aspnet_isapi.dll And Aspnet_wp.exe In The Page Loading Process?
inetinfo.exe is theMicrosoft IIS server running, handling ASP.NET requests among other things.When an ASP.NET request is received (usually a file with .aspx extension), the ISAPI filter aspnet_isapi.dll takes care of it by passing the request to the actual worker process aspnet_wp.exe.
What's The Difference Between Response.write() Andresponse.output.write()?
Response.Output.Write() allows you to write formatted output.
What Methods Are Fired During The Page Load?
Init()-when the page is instantiated.
Load()-when the page is loaded into server memory.
PreRender()-the brief moment before the page is displayed to the user as HTML.
Unload()-when page finishes loading.
When During The Page Processing Cycle Is Viewstate Available?
After the Init() and before the Page_Load(), or OnLoad() for a control.
What Namespace Does The Web Page Belong In The .net Framework Class Hierarchy?:System.Web.UI.Page
Where Do You Store The Information About The User's Locale?
System.Web.UI.Page.Culture
What's The Difference Between Codebehind="mycode.aspx.cs" Andsrc="mycode.aspx.cs"?
CodeBehind is relevant to Visual Studio.NET only.
What's A Bubbled Event?
When you have a complex control, like DataGrid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their eventhandlers, allowing the main DataGrid event handler to take care of its constituents.
Are Namespaces And Class Names Are Case Sensitive?
Namespaces and Class names are case Sensitive. Namespaces imported using the @ Import Directive will cause an error if the correct case is not used.
How To Get The Url Of Page Dynamically?
Use Request.Url property.
How To Convert User Input In Dmy Format To Mdy?
VB.NET
Dim dt As DateTime = DateTime.ParseExact("0299", New String() {"My", "M/y"}, Nothing, System. Globalization. Date Time Styles.None)
C#
DateTime dt = DateTime.ParseExact("0299", new string[] {"My","M/y"}, null,System. Globalization. Date Time Styles.None);
When The User Is Prompted A File Download Dialogbox, If The User Selects "save" Then The "save As" Dialog Box Is Displayed. Is There Any Way For Me To Retrieve The Filename And Directory Path Specified By The User On The File Download Dialog Box?
Clients do not report information back about where the user selects to save the content, so there isn't an easy way to do this. Instead, you would need to ask the user before using the content-disposition for a file path, and then you could specify the filename parameter for the content-disposition header. Still, the user is free to change that path when actually downloading.
How To Hide Or Show Controls In Server Side Code?
In any appropriate event write
VB.NET
TextBox1.Visible =not TextBox1.Visible
C#
TextBox1.Visible =!TextBox1.Visible;
How To Check If The User Is Using A Secure Or Non Secure Connection?
The Request Object defines a Property called IsSecureConnection, that will indicate whether http:// or https:// has been used.
Is It Possible To Write Code In Many Languages In One Asp.net Project?
You cannot write the code-behind files in different languages in the same project, but you can write the aspx pages and ascx controls in different languages.
What Is The Difference Between Response.redirect() And Server.transfer().
Response.Redirect
Tranfers the page control to the other page, in other words it sends the request to the other page.
Causes the client to navigate to the page you are redirecting to. In http terms it sends a 302 response to the client, and the client goes where it's told.
Server.Transfer
Only transfers the execution to another page and during this you will see the URL of the old page since only execution is transfered to new page and not control.
Occurs entirely on the server, no action is needed by the client Sometimes for performance reasons, the server method is more desirable
How To Get The Hostname Or Ip Address Of The Server?
You can use either of these
HttpContext.Current.Server.MachineName
HttpContext.Current.Request.ServerVariables["LOCAL_ADDR"]
The first one should return the name of the machine, the second returns the local ip address.
Note: that name of the machine could be different than host, since your site could be using host headers.
What Is The Meaning Of Validaterequest=true In .net Framework1.1?
The value of validateRequest is set to 'true' by default, which means that the framework will automatically deny submission of the '<'and'>' characters.
What Is The Different Between <%# %> And <%= %>?
The <%# %> is used for databinding where as <%= %> is used to output the result of an expression. The expression inside <%# %> will be executed only when you call the page's or control's DataBind method. The expression inside <%= %> will be executed and displayed as and when it appears in the page.
What Permissions Do Asp.net Applications Posses By Default?
By default ASP.NET Web applications run as ASP.NET user. This user has limited permissions equivalent to the User Group.
How Can I Specify The Relative Path For A File?
Suppose you have following file hierarchy
default.aspx
Admin/login.aspx
Misc/testpage.aspx
And you are on the login.aspx and want your user to navigate to the default.aspx (or testpage.aspx) file. Then you can use
Response.Redirect ("../default.aspx").
Response.Redirect ("../Misc/testpage.aspx").
How To Make Vs.net Use Flowlayout As The Default Layout Rather Than The Gridlayout?
For VB.NET, go to path C:Program Files Microsoft Visual Studio .NET Vb7 VBWizards WebForm Templates 1033
Change the following line in the existing WebForm1.aspx
<body MS_POSITIONING="[!output DEFAULT_HTML_LAYOUT]">to
For C#, go to path C: Program Files Microsoft Visual Studio .NET 2003 VC# VC# Wizards CSharp WebApp Wiz Templates 1033
Change the following line in the existing WebForm1.aspx
<body MS_POSITIONING="[!output DEFAULT_HTML_LAYOUT]">to
Note:Before changing any templates it's a good idea to make backup copies of them Or rather than above approach you can change the behavior for new files on a per project basis in Visual Studio by
Right clicking on the project name (Ex: "WebApplication1)" in Solution Explorer, and select "Properties".
From project properties window, under Common Properties>Designer Defaults>Page Layout change "Grid" to "Flow".
Can I Use A Datareader To Update/insert/delete A Record?
No.
DataReader provides a means of reading a forward-only stream of rows from a database.
How To Format A Telphone Number In The Xxx-xxx-xxxx Format?
VB.NET
Dim Telno As Double = Double.Parse(ds.Tables(0).Rows(0)("TelNo"). ToString())
Response.Write(Telno.ToString("###-###-####"))
C#
double Telno= double.Parse(ds.Tables[0].Rows[0]["TelNo"]. ToString());
Response.Write(Telno.ToString("###-###-####"));
Can Two Different Programming Languages Be Mixed In A Single Aspx File?
No.
ASP.NET uses parsers to strip the code from ASPX files and copy it to temporary files containing derived Page classes, and a given parser understands only one language.
Samsung Electronics Most Frequently Asked Latest ASP.NET Interview Questions Answers |
Can I Use Custom .net Data Types In A Web Form?
Yes.
Place the DLL containing the type in the application root's bin directory and ASP.NET will automatically load the DLL when the type is referenced. This is also what happens when you add a custom control from the toolbox to your web form.
How Can I Have A Particular Web Page In An Asp.net Application Which Displays Its Own Error Page?
This can be done by setting the ErroPage attribute of Page Directive or ErrorPage property of Page Class to the desired Custom Error Page
<%@Page Language="C#" ErrorPage="specificerropage.htm"%>
In web.config
<customErrors mode="On" />
Describe The Role Of Inetinfo.exe, Aspnet_isapi.dll And Aspnet_wp.exe In The Page Loading Process?
inetinfo.exe is theMicrosoft IIS server running, handling ASP.NET requests among other things.When an ASP.NET request is received (usually a file with .aspx extension), the ISAPI filter aspnet_isapi.dll takes care of it by passing the request to the actual worker process aspnet_wp.exe.
What's The Difference Between Response.write() Andresponse.output.write()?
Response.Output.Write() allows you to write formatted output.
What Methods Are Fired During The Page Load?
Init()-when the page is instantiated.
Load()-when the page is loaded into server memory.
PreRender()-the brief moment before the page is displayed to the user as HTML.
Unload()-when page finishes loading.
When During The Page Processing Cycle Is Viewstate Available?
After the Init() and before the Page_Load(), or OnLoad() for a control.
What Namespace Does The Web Page Belong In The .net Framework Class Hierarchy?:System.Web.UI.Page
Where Do You Store The Information About The User's Locale?
System.Web.UI.Page.Culture
What's The Difference Between Codebehind="mycode.aspx.cs" Andsrc="mycode.aspx.cs"?
CodeBehind is relevant to Visual Studio.NET only.
What's A Bubbled Event?
When you have a complex control, like DataGrid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their eventhandlers, allowing the main DataGrid event handler to take care of its constituents.
Are Namespaces And Class Names Are Case Sensitive?
Namespaces and Class names are case Sensitive. Namespaces imported using the @ Import Directive will cause an error if the correct case is not used.
How To Get The Url Of Page Dynamically?
Use Request.Url property.
How To Convert User Input In Dmy Format To Mdy?
VB.NET
Dim dt As DateTime = DateTime.ParseExact("0299", New String() {"My", "M/y"}, Nothing, System. Globalization. Date Time Styles.None)
C#
DateTime dt = DateTime.ParseExact("0299", new string[] {"My","M/y"}, null,System. Globalization. Date Time Styles.None);
When The User Is Prompted A File Download Dialogbox, If The User Selects "save" Then The "save As" Dialog Box Is Displayed. Is There Any Way For Me To Retrieve The Filename And Directory Path Specified By The User On The File Download Dialog Box?
Clients do not report information back about where the user selects to save the content, so there isn't an easy way to do this. Instead, you would need to ask the user before using the content-disposition for a file path, and then you could specify the filename parameter for the content-disposition header. Still, the user is free to change that path when actually downloading.
How To Hide Or Show Controls In Server Side Code?
In any appropriate event write
VB.NET
TextBox1.Visible =not TextBox1.Visible
C#
TextBox1.Visible =!TextBox1.Visible;
How To Check If The User Is Using A Secure Or Non Secure Connection?
The Request Object defines a Property called IsSecureConnection, that will indicate whether http:// or https:// has been used.
Is It Possible To Write Code In Many Languages In One Asp.net Project?
You cannot write the code-behind files in different languages in the same project, but you can write the aspx pages and ascx controls in different languages.
What Is The Difference Between Response.redirect() And Server.transfer().
Response.Redirect
Tranfers the page control to the other page, in other words it sends the request to the other page.
Causes the client to navigate to the page you are redirecting to. In http terms it sends a 302 response to the client, and the client goes where it's told.
Server.Transfer
Only transfers the execution to another page and during this you will see the URL of the old page since only execution is transfered to new page and not control.
Occurs entirely on the server, no action is needed by the client Sometimes for performance reasons, the server method is more desirable
How To Get The Hostname Or Ip Address Of The Server?
You can use either of these
HttpContext.Current.Server.MachineName
HttpContext.Current.Request.ServerVariables["LOCAL_ADDR"]
The first one should return the name of the machine, the second returns the local ip address.
Note: that name of the machine could be different than host, since your site could be using host headers.
What Is The Meaning Of Validaterequest=true In .net Framework1.1?
The value of validateRequest is set to 'true' by default, which means that the framework will automatically deny submission of the '<'and'>' characters.
What Is The Different Between <%# %> And <%= %>?
The <%# %> is used for databinding where as <%= %> is used to output the result of an expression. The expression inside <%# %> will be executed only when you call the page's or control's DataBind method. The expression inside <%= %> will be executed and displayed as and when it appears in the page.
What Permissions Do Asp.net Applications Posses By Default?
By default ASP.NET Web applications run as ASP.NET user. This user has limited permissions equivalent to the User Group.
How Can I Specify The Relative Path For A File?
Suppose you have following file hierarchy
default.aspx
Admin/login.aspx
Misc/testpage.aspx
And you are on the login.aspx and want your user to navigate to the default.aspx (or testpage.aspx) file. Then you can use
Response.Redirect ("../default.aspx").
Response.Redirect ("../Misc/testpage.aspx").
Post a Comment