June 2005 - Posts
I found this link, its really very beneficial:
http://authors.aspalliance.com/olson/methods/
Regards
I would like to point to a good article written by Terri Morton @ aspalliance.com:
http://aspalliance.com/687
Regards
I would like to congratulate Layale Bassil for the great achievement she did today.
Layale presented her Final Year Project at the Lebanese American University – Byblos Campus, despite the death that her grandfather left away this morning. She was able to challenge herself and her sad situation and present a very well performed Final Year Project.
All my condolences to you Layale and your family
Congratulations for your graduation with a BE in Computer and Communication Engineering.
Regards
This is a very common question on the ASP.NET Forum.
I decided to provide the following solution. I will create a DataTable, create 2 DataColumns (IntergerValue and StringValue), then add 5 rows to the DataTable.
After that, I will add the DataTable dt to the collection of Tables of the DataSet ds.
Finally, I will loop though the rows of the table inside the DataSet and print out each row by row.
In real-life, the DataSet ds can be filled with the SqlDataAdapter by executing a query against the DataBase.
For simplicity, I will create a simple DataTable and add it to the DataSet. The code is as follows:
// Create new DataTable
DataTable dt = new DataTable();
// Create new DataSet
DataSet ds = new DataSet();
// Create new DataRow
DataRow dr;
// Define the columns of the table.
dt.Columns.Add(new DataColumn("IntegerValue", typeof(Int32)));
dt.Columns.Add(new DataColumn("StringValue", typeof(string)));
// Populate the table with sample values.
for (int i = 0; i < 5; i++)
{
dr = dt.NewRow();
dr[0] = i;
dr[1] = "Item " + i.ToString();
dt.Rows.Add(dr);
}
// Add the above DataTable to the collection of tables in the DataSet
ds.Tables.Add(dt);
// Loop through the rows of the only table in the DataSet
foreach( DataRow dataRow in ds.Tables[0].Rows)
{
Response.Write("Integer Value : " + dataRow["IntegerValue"].ToString() + "<br>");
Response.Write("String Value : " + dataRow["StringValue"].ToString() + "<br>");
}
Hope that helps.
In ASP.NET 2.0 Beta 2, two new configuration classes have been added:
1- ConfigurationManager:
Used to update sections inside the App.Config file.
2- WebConfigurationManager:
Used to update setions inside Web.Config file.
To see how to add some keys to the AppSettings section in the web.config file, check the code below:
Configuration configFile =
WebConfigurationManager.OpenWebConfiguration("~");
AppSettingsSection AppSection =
configFile.GetSection("appSettings") as AppSettingsSection;
AppSection.Settings.Add(
new KeyValueConfigurationElement("SMTP", "mail.bhaidar.net")
);
configFile.Save();
The above code would add the following line to the appSettings section.
<appSettings>
<add key="SMTP" value="mail.bhaidar.net" />
</appSettings>
Make sure to include:
using System.Web.Configuration;
Hope that helps you.
Regards
I would like to point out some of the similarities/differences bewteen both Session and Profile objects:
Profile:
1- Profile object is scoped to a particular user:
Each user of a web application automatically has his own profile.
2- Profile object is persistant:
When you modify the stat os the profile object, the modifications are saved between visits to the website
3- Profile object uses the provider model to store information:
By default, the contents of a user profile are automatically saved to a Microsoft SQL Server Express database
located in App_Data of your web application.
4- Profile object is strongly typed:
Using strongly typed properties has several advantages. For example, you get full Microsoft IntelliSense when
using the Profile object in VS.NET 2005 or Visual Web Developer
Session:
1- Session object is scoped to a particular user:
Each user of a web application automatically has his own Session state.
2- Session object is non-persistant:
When you add an item to the Session object, the items disappear after you leave the Web site.
3- Session object uses three different ways to be stored:
3.1: In Process - default
3.2: State Server (Out of Process)
3.3: SQL Server
4- Session object is not strongly typed:
Sessopn object is simply a collection of items.
Hope you enjoyed the post.
Regards
I was exploring today Profile and how to work with them.
I notice something which I would like to share it with you.
Suppose we have the following configuration section:
<authentication mode="Forms"/>
<anonymousIdentification enabled="true"/>
<profile enabled="true">
<properties>
<add name="ZipCode" type="int" />
<add name="EmailAddresses" type="System.Collections.Specialized.StringCollection" serializeAs="Xml" />
<group name="Address">
<add name="Street" type="System.String" />
<add name="City" type="System.String" />
<add name="State" type="System.String" />
<add name="CountryOrRegion" type="System.String" />
< FONT>group>
< FONT>properties>
< FONT>profile>
FormsAuthentication is used, Anonymous Identification is enabled. Keep in mind that the first time the page executes you are considered an anonymous user.
Inside the code, you can set the value for Profile.EmailAddress.Add(”...”), despite the fact that:
1- You did not add allowAnonymous to the field EmailAddresses.
2- Whatever the value of AnonymousIdentification's value (enabled/disabled) is.
However, you cannot set the value for any of the group profile members without having to explicitly add the allowAnonymous field to any of the properties of the group, despite the fact you have enabled AnonymousIdentification.
Strange ha?
Regards
A great post about reading a ConfigurationSection in asp.net 2.0 by Fredrik Normen.
Check the post @ : http://fredrik.nsquared2.com/viewpost.aspx?PostID=253&showfeedback=true
Regards
Fredrik Normen explains the ConfigurationManager in details.
Check his post @ : http://fredrik.nsquared2.com/viewpost.aspx?PostID=252&showfeedback=true
Regards
A common requirement of web applications is the need to obtain the user's username and password.
In this article, I build a customizable Login server control that can be added easily to any ASP.NET Web Form.
To check this article, please follow this [link].
Regards
There is a common question that is always being asked on the asp.net forums:
“How to popup a window inside an asp.net page”,
I felt it would be easier for all developers to provide them with such a control.
Please check the [
Hi:
This is my first post on my Blog.
I have been working for some time with asp.net 2.0. The first thing I did was to know what is the page-life cycle in asp.net 2.0. But I was not successful enough to find what I need until recently I found a diagram that explains in details all the methods involved in the asp.net 2.0 Beta1 page-life cycle.
Have a look at : http://hydrate.typepad.com/leo/2004/08/the_aspnet_v20_.html
Regards