2) What have you done in your module?
( I said that I worked on user authentication....)
3) I was asked about how a user can be authenticated.
4) Did you create authcookie? how you handle authecookie? I mean did you create it manually?
( I told him that there is method which take care of creating authcookie during authentication. That method is "RedirectFromLoginPage" . He replied me thats what he was expecting..
5) What is difference you observe between framework v2.0 and framework 3.5?
6) What are the different session management techniques? What method did you do in your project?
7) What is the difference between usercontrol and custom control?
Factors | User control | Custom control |
Deployment | Designed for single-application scenarios Deployed in the source form (.ascx) along with the source code of the application If the same control needs to be used in more than one application, it introduces redundancy and maintenance problems | Designed so that it can be used by more than one application Deployed either in the application's Bin directory or in the global assembly cache Distributed easily and without problems associated with redundancy and maintenance |
Creation | Creation is similar to the way Web Forms pages are created; well-suited for rapid application development (RAD) | Writing involves lots of code because there is no designer support |
Content | A much better choice when you need static content within a fixed layout, for example, when you make headers and footers | More suited for when an application requires dynamic content to be displayed; can be reused across an application, for example, for a data bound table control with dynamic rows |
Design | Writing doesn't require much application designing because they are authored at design time and mostly contain static data | Writing from scratch requires a good understanding of the control's life cycle and the order in which events execute, which is normally taken care of in user controls |
8) Suppose you are implenting cache in a scenario where time is placed in cache and time shows different time for different time regions. How would you achieve this?
( I told that varyByParam property will take care of that..)
9)How page execution is done in asp.net?
(nothing but page life cycle..I forgot to tell page_unload event )
10) Can you pass parameters to command object?
11) you have a command object which executes a Storedprocedure. This SP takes x as parameter and y as output parameter. I want to show the output return by the SP on the aspx page.
Use a Stored Procedure which takes empid as input parameter and returns depid of that employee. For this take a dropdown with collection of employees. When selecting an item in dropdown, it will give the deptid of that selected employee in dropdown.
First create SP which takes one i/p and gives one o/p parameters..
CREATE PROCEDURE SP_Test(@EmpID int,@DeptID int OUTPUT)
AS
BEGIN
SELECT @DeptID = DeptID FROM MY_EMP_DETAILS WHERE EmpID=@EmpID
END
Execution of the above SP for testing...
DECLARE @Dept INT
EXEC SP_TEST 15, @Dept OUTPUT
PRINT @Dept
======================================
using System.Data;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
SqlConnection SqlCon = new SqlConnection("server=servername;database=databasename;user id=sa;password=xxx");
SqlCommand SqlCom;
protected void Page_Load(object sender, EventArgs e)
{
//fill the employee dropdown...
if (!IsPostBack)
{
SqlCon.Open();
SqlCom = new SqlCommand();
SqlCom.Connection = SqlCon;
SqlCom.CommandText = "select EmpID, EmpName from MY_EMP_DETAILS";
SqlCom.CommandType = CommandType.Text;
DataSet ds=new DataSet();
SqlDataAdapter SqlDa = new SqlDataAdapter(SqlCom);
SqlDa.Fill(ds);
SqlCon.Close();
ddlEmp.DataValueField = ds.Tables[0].Columns["EmpID"].ColumnName;
ddlEmp.DataTextField = ds.Tables[0].Columns["EmpName"].ColumnName;
ddlEmp.DataSource = ds;
ddlEmp.DataBind();
}
}
protected void ddlEmp_SelectedIndexChanged(object sender, EventArgs e)
{
SqlCom = new SqlCommand();
SqlCom.Connection = SqlCon;
//Input parameter declaration...
SqlCom.Parameters.Add("@EmpID", SqlDbType.Int);
//Output parameters declaration....
SqlCom.Parameters.Add("@DeptID", SqlDbType.Int);
SqlCom.CommandText = "SP_Test";
SqlCom.CommandType = CommandType.StoredProcedure;
SqlCom.Parameters["@EmpID"].Value = ddlEmp.SelectedValue;
//Must specify direction for output parameter in Storedprocedure...
SqlCom.Parameters["@DeptID"].Direction = ParameterDirection.Output;
SqlCon.Open();
SqlDataReader dr= SqlCom.ExecuteReader(CommandBehavior.CloseConnection);
dr.Close();
Response.Write("Employee " + ddlEmp.SelectedItem.Text + " Department ID is " + SqlCom.Parameters["@DeptID"].Value.ToString());
}
}
Note: use the link given to know various ways of returning values from a StoredProcedure..
http://www.4guysfromrolla.com/articles/062905-1.aspx#postadlink
Note: use the link given to know various ways of returning values from a StoredProcedure..
http://www.4guysfromrolla.com/articles/062905-1.aspx#postadlink
12) How do you fill the datatable in dataset using datareader?
(I told that create a table object, create a new row, fill the datareader values into newrow. All this is done in while loop which takes dr.read() as a condition...He again said that this is what he is expecting from his question..)13) How you choose an interface and an abstract class?
14) What is httpHandler and httpMethods?
15) ADO.NET Architecture?
16) I have a parent class and one child class which is inhertted from parent class. Now I write Parent class Obj =new parent class(). Is this give any Error?
( I said no and he asks again on that..)
17) I have like parent class Obj = new child class(). Is this gives any error?
(I said its perfectly working..)
18) I have like child class obj = new parent class(). Is this gives any error?
( I said I am not sure...but I think it gives error...)
(Actually thing is that, the above line is correct if you cast new parent class object in to child class..otherwise it gives compile error..)
19) What is boxing and un-boxing?
20) What is cross page posting. How do you achieve it?
21) What is partial class. What is the use of that?
22) I dont want to store user credentials in database or xml file. Can you tell me the other way of storing them?
23) Did you give password in plain text in web.config file? If not, how do you do that?
24) What is the difference between string and String?
Both are same. Just one is alias for the other. For declaring String, you need using System namespace where as string doesnot require any namespace to use.
25) Where do you set master page dynamically? Which property do you use to set it?
In the PreInit event, we can set the master page dynamically. Using the 'MasterPageFile' property we assign the master page. Here is a piece of code....
void Page_PreInit(Object sender, EventArgs e) { this.MasterPageFile = "~/NewMaster.master"; }
26) What is the difference between Server.Transfer and Response.Redirect?
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.