What is Application Blocks?
What are the processes to implement the strong name in the assembly?
How to use Memory management in .Net?
What is serialization in .NET? What are the ways to control serialization?
if there are two version of assembly is installed in computer the how we decide that which is using ?
Ans-- Assembly information is stored in manifest, there are 4 version of assembly (major, minor, build and revision) so we can decide the version through major and minor minor like 2.0.--.—
What is the difference between the application and caching?
what is assembly placement?
What are three test cases you should go through in unit testing?
Positive test cases (correct data, correct output), negative test cases (broken or missing data, proper handling), exception test cases (exceptions are thrown and caught properly).
What are possible implementations of distributed applications in .NET?
What is the consideration in deciding to use .NET Remoting or ASP.NET Web Services?
What security measures exist for .NET Remoting in System.Runtime.Remoting?
None. Security should be taken care of at the application level. Cryptography and other security techniques can be applied at application or server level.
What is a formatter?
A formatter is an object that is responsible for encoding and serializing data into messages on one end, and deserializing and decoding messages into data on the other end.
Can you configure a .NET Remoting object via XML file?
Yes, via machine.config and application level .config file (or web.config in ASP.NET). Application-level XML settings take precedence over machine.config.
Describe the role of inetinfo.exe, aspnet_isapi.dll andaspnet_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 namespace does the Web page belong in the .NET Framework class hierarchy?
System.Web.UI.Page
Thursday, December 16, 2010
Friday, December 10, 2010
Update Existing Xml and If Xml is not created it will create and then update the Existing Xml...
static public void MoveUserInfo(string destFolder)
{
string _sourcePath = "";
string _configurationPath = "";
_sourcePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory.ToString(), "UserInfo.xml");
_configurationPath = Path.Combine(Path.Combine(destFolder, "Configuration"), "UserInfo.xml");
if (!Directory.Exists(Path.Combine(destFolder, "Configuration")))
Directory.CreateDirectory(Path.Combine(destFolder, "Configuration"));
if (File.Exists(_configurationPath) == true)
{
updateUserInfoXML(_sourcePath, _configurationPath);
}
else //Create UserInfo.Xml file into Directory if not Exist in the Destination Path..
{
File.Copy(_sourcePath, _configurationPath, true);
}
}
static public void updateUserInfoXML(string pathSource, string pathDestination)
{
try
{
XmlDocument docSource = new XmlDocument();
XmlDocument docDestination = new XmlDocument();
string xmlMmessage = "";
docSource.Load(pathSource);
docDestination.Load(pathDestination);
XmlNodeList elemList = docSource.GetElementsByTagName("Asset");
//XmlNodeList elemListRoll = docSource.GetElementsByTagName("role");
//XmlNodeList elemListUser = docSource.GetElementsByTagName("User");
string attrAssetID;
XmlNodeList eleDestNodeList;
XmlNode eleDestinationNode = docDestination.DocumentElement;
foreach (XmlNode eleSourceNode in elemList)
{
attrAssetID = eleSourceNode.Attributes["assetid"].Value;
// attrRollID = eleSourceNode.Attributes["rollid"].Value;
//attrUserID = eleSourceNode.Attributes["Userid"].Value;
eleDestNodeList = docDestination.SelectNodes("/UserInfo/Asset[@assetid='" + attrAssetID.ToString() + "']");
if (eleDestNodeList.Count > 0)
{
eleDestinationNode = docDestination.SelectSingleNode("/UserInfo/Asset[@assetid='" + attrAssetID.ToString() + "']");
//docSource.AppendChild()
//---IF NODE EXISTS THEN REPLACE THE SOURCE NODE WITH TARGET NODE
XmlDocumentFragment fragment = docDestination.CreateDocumentFragment();
fragment.InnerXml = eleSourceNode.OuterXml;
eleDestinationNode.ParentNode.ReplaceChild(fragment, eleDestinationNode);
xmlMmessage = "Sucessfully replaced";
}
else
{
//---IF NODE IS NOT EXISTS THEN APPEND THE SOURCE NODE WITH TARGET NODE
XmlDocumentFragment fragment = docDestination.CreateDocumentFragment();
fragment.InnerXml = eleSourceNode.OuterXml;
eleDestinationNode.AppendChild(fragment);
xmlMmessage = "Sucessfully Append";
}
}
docDestination.PreserveWhitespace = true;
docDestination.Save(pathDestination);
Console.WriteLine(xmlMmessage);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message.ToString());
Console.ReadLine();
}
}
{
string _sourcePath = "";
string _configurationPath = "";
_sourcePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory.ToString(), "UserInfo.xml");
_configurationPath = Path.Combine(Path.Combine(destFolder, "Configuration"), "UserInfo.xml");
if (!Directory.Exists(Path.Combine(destFolder, "Configuration")))
Directory.CreateDirectory(Path.Combine(destFolder, "Configuration"));
if (File.Exists(_configurationPath) == true)
{
updateUserInfoXML(_sourcePath, _configurationPath);
}
else //Create UserInfo.Xml file into Directory if not Exist in the Destination Path..
{
File.Copy(_sourcePath, _configurationPath, true);
}
}
static public void updateUserInfoXML(string pathSource, string pathDestination)
{
try
{
XmlDocument docSource = new XmlDocument();
XmlDocument docDestination = new XmlDocument();
string xmlMmessage = "";
docSource.Load(pathSource);
docDestination.Load(pathDestination);
XmlNodeList elemList = docSource.GetElementsByTagName("Asset");
//XmlNodeList elemListRoll = docSource.GetElementsByTagName("role");
//XmlNodeList elemListUser = docSource.GetElementsByTagName("User");
string attrAssetID;
XmlNodeList eleDestNodeList;
XmlNode eleDestinationNode = docDestination.DocumentElement;
foreach (XmlNode eleSourceNode in elemList)
{
attrAssetID = eleSourceNode.Attributes["assetid"].Value;
// attrRollID = eleSourceNode.Attributes["rollid"].Value;
//attrUserID = eleSourceNode.Attributes["Userid"].Value;
eleDestNodeList = docDestination.SelectNodes("/UserInfo/Asset[@assetid='" + attrAssetID.ToString() + "']");
if (eleDestNodeList.Count > 0)
{
eleDestinationNode = docDestination.SelectSingleNode("/UserInfo/Asset[@assetid='" + attrAssetID.ToString() + "']");
//docSource.AppendChild()
//---IF NODE EXISTS THEN REPLACE THE SOURCE NODE WITH TARGET NODE
XmlDocumentFragment fragment = docDestination.CreateDocumentFragment();
fragment.InnerXml = eleSourceNode.OuterXml;
eleDestinationNode.ParentNode.ReplaceChild(fragment, eleDestinationNode);
xmlMmessage = "Sucessfully replaced";
}
else
{
//---IF NODE IS NOT EXISTS THEN APPEND THE SOURCE NODE WITH TARGET NODE
XmlDocumentFragment fragment = docDestination.CreateDocumentFragment();
fragment.InnerXml = eleSourceNode.OuterXml;
eleDestinationNode.AppendChild(fragment);
xmlMmessage = "Sucessfully Append";
}
}
docDestination.PreserveWhitespace = true;
docDestination.Save(pathDestination);
Console.WriteLine(xmlMmessage);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message.ToString());
Console.ReadLine();
}
}
Create Xml File (using dataset)
StringBuilder _UserInfo = new StringBuilder();
dataset infoDS=new DataSet();
DataSet infoDS = PXE.Facade.PXEFacade.GetUserRoleOnAsset(bookId, nAssetId);
_UserInfo.Append("");
_UserInfo.Append("");
_UserInfo.Append("");
for (int i = 0; i < infoDS.Tables[0].Rows.Count; i++) { if (infoDS.Tables[0].Rows.Count > 0)
{
string _RoleId = infoDS.Tables[0].Rows[i]["roleid"].ToString();
string _UserId = infoDS.Tables[0].Rows[i]["userid"].ToString();
string _RoleName = infoDS.Tables[0].Rows[i]["roleName"].ToString();
string _Abbreviation = infoDS.Tables[0].Rows[i]["abbreviation"].ToString();
string _DisplayName = infoDS.Tables[0].Rows[i]["displayName"].ToString();
_UserInfo.Append("");
_UserInfo.Append(" ");
_UserInfo.Append(" ");
//_UserInfo.Append(" ");
if (File.Exists(tempFolder + "\\UserInfo.xml"))
{
File.SetAttributes(tempFolder + "\\UserInfo.xml", FileAttributes.Normal);
}
StreamWriter _sw1 = new StreamWriter(tempFolder + "\\UserInfo.xml");
_sw1.WriteLine(_UserInfo.ToString());
_sw1.Flush();
_sw1.Close();
_sw1.Dispose();
}
}
StreamWriter _sw = new StreamWriter(tempFolder + "\\UserInfo.xml");
_UserInfo.Append("");
_UserInfo.Append(" ");
_sw.WriteLine(_UserInfo.ToString());
_sw.Flush();
_sw.Close();
_sw.Dispose();
/**/
dataset infoDS=new DataSet();
DataSet infoDS = PXE.Facade.PXEFacade.GetUserRoleOnAsset(bookId, nAssetId);
_UserInfo.Append("");
_UserInfo.Append("
_UserInfo.Append("
for (int i = 0; i < infoDS.Tables[0].Rows.Count; i++) { if (infoDS.Tables[0].Rows.Count > 0)
{
string _RoleId = infoDS.Tables[0].Rows[i]["roleid"].ToString();
string _UserId = infoDS.Tables[0].Rows[i]["userid"].ToString();
string _RoleName = infoDS.Tables[0].Rows[i]["roleName"].ToString();
string _Abbreviation = infoDS.Tables[0].Rows[i]["abbreviation"].ToString();
string _DisplayName = infoDS.Tables[0].Rows[i]["displayName"].ToString();
_UserInfo.Append("
_UserInfo.Append("
_UserInfo.Append("
//_UserInfo.Append("
if (File.Exists(tempFolder + "\\UserInfo.xml"))
{
File.SetAttributes(tempFolder + "\\UserInfo.xml", FileAttributes.Normal);
}
StreamWriter _sw1 = new StreamWriter(tempFolder + "\\UserInfo.xml");
_sw1.WriteLine(_UserInfo.ToString());
_sw1.Flush();
_sw1.Close();
_sw1.Dispose();
}
}
StreamWriter _sw = new StreamWriter(tempFolder + "\\UserInfo.xml");
_UserInfo.Append("");
_UserInfo.Append("
_sw.WriteLine(_UserInfo.ToString());
_sw.Flush();
_sw.Close();
_sw.Dispose();
/**/
Labels:
Create Xml File (using dataset)
Sunday, November 14, 2010
Distinct Value from two array
string[] a1 = { "A", "B", "A", "C", "C" };
string[] a2 = { "A", "E", "C", "D", "C" };
// var unique = a1.Union(a2);
string[] a3 = new string[a1.Length + a2.Length];
a1.CopyTo(a3, 0);
a2.CopyTo(a3, a1.Length);
ArrayList arr = new ArrayList();
for (int k = 0; k < a3.Length; k++)
{
arr.Add(a3[k].ToString());
}
for (int i = 0; i < arr.Count - 1; i++)
{
for (int j = i + 1; j < arr.Count; j++)
{
if (arr[i].Equals(arr[j]))
{
arr.RemoveAt(j);
}
}
}
for (int i = 0; i < arr.Count; i++)
{
arr.Sort();
Console.WriteLine(arr[i]);
}
Console.ReadLine();
string[] a2 = { "A", "E", "C", "D", "C" };
// var unique = a1.Union(a2);
string[] a3 = new string[a1.Length + a2.Length];
a1.CopyTo(a3, 0);
a2.CopyTo(a3, a1.Length);
ArrayList arr = new ArrayList();
for (int k = 0; k < a3.Length; k++)
{
arr.Add(a3[k].ToString());
}
for (int i = 0; i < arr.Count - 1; i++)
{
for (int j = i + 1; j < arr.Count; j++)
{
if (arr[i].Equals(arr[j]))
{
arr.RemoveAt(j);
}
}
}
for (int i = 0; i < arr.Count; i++)
{
arr.Sort();
Console.WriteLine(arr[i]);
}
Console.ReadLine();
Labels:
Distinct Value from two array
Distinct Value from two array(Linq)
string[] a1 = { "A", "B", "A", "C", "C" };
string[] a2 = { "A", "E", "C", "D", "C" };
var unique = a1.Union(a2);
string[] a2 = { "A", "E", "C", "D", "C" };
var unique = a1.Union(a2);
Wednesday, November 10, 2010
AutoIncremented Number
public string NewRequestID()
{
string NewID = "";
SqlDataAdapter da = default(SqlDataAdapter);
DataTable dt = null;
da = new SqlDataAdapter("select top 1 code from EmpMaster order by code desc", con);
dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count != 0)
{
string str = dt.Rows[0]["Code"].ToString();
int i = Convert.ToInt32(str.Substring(1));
NewID = (i + 1).ToString();
int start = NewID.Length + 1;
//Position from where 0 has to be inserted to the RequestID.
for (int j = start; j <= (str.Length - 1); j++)
{
NewID = "0" + NewID;
}
NewID = "A" + NewID;
}
else
{
NewID = "A000001";
}
return NewID;
}
{
string NewID = "";
SqlDataAdapter da = default(SqlDataAdapter);
DataTable dt = null;
da = new SqlDataAdapter("select top 1 code from EmpMaster order by code desc", con);
dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count != 0)
{
string str = dt.Rows[0]["Code"].ToString();
int i = Convert.ToInt32(str.Substring(1));
NewID = (i + 1).ToString();
int start = NewID.Length + 1;
//Position from where 0 has to be inserted to the RequestID.
for (int j = start; j <= (str.Length - 1); j++)
{
NewID = "0" + NewID;
}
NewID = "A" + NewID;
}
else
{
NewID = "A000001";
}
return NewID;
}
Labels:
AutoIncremented Number
Sunday, October 31, 2010
Transaction In sql server(Maintaining Relationship)
Create procedure sp_InsertRelation(@Code varchar(50),@Name Varchar(100),@Organisation varchar(100))
as
begin set nocount On
begin transaction
begin try
insert into empMaster(Code,Name) values(@Code,@Name)
insert into empDetails(Code,Organisation) values(@Code,@Organisation)
Commit Tran
end try
begin catch
rollback tran
end catch
End
as
begin set nocount On
begin transaction
begin try
insert into empMaster(Code,Name) values(@Code,@Name)
insert into empDetails(Code,Organisation) values(@Code,@Organisation)
Commit Tran
end try
begin catch
rollback tran
end catch
End
Subscribe to:
Posts (Atom)