|
|
Browse by Tags
All Tags » ASP.NET 2.0 - General
-
A great article by Brad Adams on accessing the ASP.NET Authentication, Profile and Role Services in Silerlight!
Check it out here: http://blogs.msdn.com/brada/archive/2008/05/03/accessing-the-asp-net-authentication-profile-and-role-service-in-silverlight.aspx
Hope you enjoy it!Regards
-
I found a good resource on validating user input on Channel9. You can reach that resource by following this link: http://channel9.msdn.com/wiki/default.aspx/SecurityWiki.RegExInputValCode2
The page contains a set of utility methods to help you in validating the inputs for your web application. The technique used is ''whitelisting'' ...
-
*** Updated - April 7 2008 ***
I played a little bit with the command line I am using to install the SQL Server Session State database and it seems to work fine: To register the database for the SQL Server Session State on ASP.NET 2.0 or ASP.NET 3.5:
aspnet_regsql -C ''Data Source=.;Integrated Security=True'' -ssadd -sstype c -d ...
-
I faced a situation today where I am trying to attach to the page_load event of a child nested master page to load some data on the master page itself. The event was not firing at all. Later on I figured out that the AutoEventWireup property on the Page directive is false!!!
Seems by default when you create a nested master page, its ...
-
I have posted a new article on the ASP.NET Wiki and the article is titled as:
How to Postback Asynchronously from inside a GridView
Check it out and have your comments and improvements!Regards
-
The Visual Studio Web Tools team added a new HotFix for the Visual Studio Web environment.
You can read all the details about the fix here and download the hotfix from here.
Regards
-
When working with an ASP.NET Web Application under Vista/IIS 7 and developing an HttpModule, watch out for the Application pool you are using. If your application is configured to work with classic application pool, then it is enough to define the module within the httpModules section as:
<httpModules> ...
-
I have updated the code I presented yesterday in: Website Menu + web.sitemap: A smart combination to handle pages that are not listed in the web.sitemap. Here is the updated code in bold:
private static string GetSubRootNode() ...
-
I am working on a website that contains a main menu on top. In addition, I am making use of the SiteMapPath to show a breadcrumb that helps the user while browsing the website. I might have the following heirarchy in the website:
Default.aspxArticles.aspx --> ...
-
In a previous post I talked about the xListBox and MoverList Controls. I did some fixes to make them work for FireFox and IE.
What was the problem actually? If you read the article about xListBox, you will notice that I have based on solution on a HiddenField to keep track of added/removed items from the ListBox on the client side and to ...
-
Scott Guthrie just announced the release of the ASP.NET AJAX 1.0 .
Check his post here: ASP.NET AJAX 1.0 Released
Regards
-
I always find a difficulty in remembering all the server variables and how they can help me, here is a list of all the server variables I ran in a testing application. You will see the server variables with a sample data coming from the testing application:
ALL_HTTP
HTTP_CONNECTION:Keep-Alive HTTP_ACCEPT:*/* HTTP_ACCEPT_ENCODING:gzip, ...
-
I was introduced yesterday to the new namespace in .NET 2.0 about Transactions. Transactions at the business layer (C# domain objects) without the use of COM+ Transactions. There are two kinds Light Weight that depends on the SQL Server 2005 (single connection), once more than one connections are used, the Light Weight Transaction Manager ...
-
The Mono project 1.2 is now released.
For those of you who don't know what Mono is, it provides you with an environment to run .NET code on Linux, Solaris, Mac OS, and Windows.
Check it out here: Mono-Project
Hope this helps,
Regards
-
On Thursday, January 4, 2007 I gave a session on Generics - .NET 2.0 for my students at the training center.
The material I had didn't include any chapter on this topic, so I prepared a small power point from the Visual C# - Complete Reference and you can download from:
Generics in .NET 2.0
Hope it helps,
Regards
-
On Tuesday, January 2, 2007 I gave a session on Collection - .NET 2.0 for my students at the training center.
The material I had didn't include any chapter on this topic, so I prepared a small power point from the Visual C# - Complete Reference and you can download from:
Collection in .NET 2.0
Hope it helps,
Regards
-
Another tip from the great book by David Sceppa is how to handle null column values:
Suppose you have a column in your table in the Database, and that column can have NULL values, the column is named ColA. Now you wanted to updated a record by checking if ColA is NULL in the WHERE clause to allow updating:
UPDATE ..... WHERE ColA = ?
The ...
-
A nice trick I read in the ASP.NET 2.0 Core Reference is that, when an exception occurs at the end of the request, that is the GetLastError of the Server object returns an exception, the Session data is lost, however, in your handler of the Exception, if you call Server.ClearError, the Session is restored!
That is a great tip Dino, ...
-
Dear All:
I would like to announce to you that I have finally released the XGrid Control on CodePlex at the following URL:
http://www.codeplex.com/Wiki/View.aspx?ProjectName=xgrid&title=Home
For those of you who don't know what the XGrid Control is, you should pass by my article on ASPAlliance.com:
http://aspalliance.com/946 -- ...
-
I have been developing an API for an application of mine at work. The API returns a set of objects in the form of Collections. I needed a way to filter the collection based on some values I provide.
I have passed by this blog post:
http://codebetter.com/blogs/brendan.tompkins/archive/2004/09/02/24116.aspx
Brendan creates something known as ...
-
A nice tip given by Stephan Walther in his latest book, ASP.NET 2.0 Unleashed is how to use a page property as a parameter to either Insert, Delete, Update, or Select parameters.
As you know, we have a set of new parameter objects that can be used to supply data to Sql, Object, and Access DataSources. Among which is the ...
-
A very common question on the ASP.NET forums is how to do expression databinding on the ASPX page.
The ASP.NET allows you to use 3 different binding expressions:
1- <% %>You can use the above expression to execute some C#/VB.NET code as follows:
<% Response.Write(''Hello World''); %>
Which will print out ''Hello ...
-
A very interesting method I came over today:
HttpResponse.ApplyAppPathModifier
According to the MSDN documentation:
Adds a session ID to the virtual path if the session is using Cookieless session state and returns the combined path. If Cookieless session state is not used, ApplyAppPathModifier returns the original virtual path.
This is very ...
-
SQL Server Provider in .NET Framework 2.0 provides a way to generate per-connection reports for measuring performance through a property in the SqlConnection object called StatisticsEnabled.
This is a sample code of how to do so:
SqlConnection conn = new SqlConnection(connectionString);
conn.Open();
conn.StatisticsEnabled = true;
// Perform ...
-
In a previous post, Provider ToolKit Configuration Utility, I published a small utility that helps you create all the needed files when you are building a new Service Provider Model.
In this post, I have upgraded that utility to allow you to create Providers not only related to Data Sources but rather to other APIs. Sometimes, we might need to ...
-
I kindly invite you to check out my latest article on the ASPAlliance.com with the title:
Store View State in a Persistent Medium, the Proper Way
Hope you will enjoy it!
Regards
-
This is the tool we have long waited from the ASP.NET Team. However, this time it came from Quality Data Corporation, it is the Membership Manager Control.
As you know the ASP.NET Configuration tool that ships with VS 2005 can be used locally to manage the membership of a website! Once the website is hosted remotely there is no way to manage your ...
-
http://90statehouse.com/forums/blogs/robertseder/archive/2006/06/04/201.aspxCheck out this important blog post that shows you how to add Template sections into your usercontrols.
We have always believed that only properties are supported by UserControls, but now this has changed!
Robert Seder discusses this idea in his blog post here.
-
Microsoft has released CodePlex Beta (http://www.codeplex.com/), a community development Web site.
Developers can use CodePlex to create new projects to share with fellow developers around the world, join others who have already started their own projects, or use the applications on this site and provide feedback.
The site is ...
-
I had a need few days ago to delete some files in the Session_End. As you know, Session_End will be fired, even if the client's session ends, because the Session is based on the Server and therefore, after the Session times-out the Session_End on the server will be executed.
However, I needed to use some properties from the HttpContext and it ...
-
I have delivered tonight a new session out of the Community Night Sessions at the Microsoft Office - Beirut Central District, that are helped by the LebDev.NET user group and sponsorship of Microsoft.
The session was about Localization in ASP.NET 2.0, you can download both the powerpoint and the code by visiting the LebDev user group website: ...
-
A very common question on the ASP.NET forums, is how to loop through the page controls, and find dynamically my control!
Here is the solution, its R E C U R S I O N !!
A very simple example, that loops through the page controls, and once it finds a Panel, it prints out, I am a Panel
public void ShowPanels(Control p_Control)
{
...
-
I have noticed today that, when you have PopulateOnDemand, and PopulateNodesFromClient both are true, then there is no way to access the Parent Node of the Current Node in your code!
I have been building a very complicated TreeView System in one of the projects working on, and I have really very complicated requirements for that Tree.
A ...
-
With ASP.NET 2.0 MasterPages, you can apply MasterPages per folder, how is that done?
<configuration>
<location path=''MyArea''>
<system.web>
<pages masterPageFile=''~/App_MasterPages/MyAreaMaster.master'' />
</system.web>
...
-
I have always had the need to use String Enumerations. What do I mean by that?
Suppose we have this Enum Type:
public enum StringNames
{
Bilal,
Wessam,
Elsa,
Samer,
Tarek,
Farah,
Firas,
Mohammad
}
In my code, I would like to have something as:
string _Name ...
-
I discovered something interesting today in the world of TreeViews!
I have been working on TreeViews and dynamic populating for those TreeViews. One thing took my attention which is that:
When I first load the root node in a dynamically populated TreeView, having:
PopulateOnDemand true for the root node
ShowExpandCollapse true
ExpandDepth = ...
-
I would like to invite you to check my latest article on the ASPAlliance.com.
The article is titled Localization in ASP.NET 2.0
Hope you will enjoy this article.
Regards
-
Assume the following:
You have a TreeView in a master page, and once a node inside that TreeView is selected, you want to be redirected to another page. In that case, the TreeView will be reset to tis original properties.
In a situation I am working on, I had a TreeView whose expansion depth is ''0'', means showing only Root node, and has ...
-
As you all know, Visual Studio 2005 Web Deployment Projects has be officially launched. Out of the cool things I like when working with WDP is the ability to include the WDP in a web setpup project.
Assuming you have created your webs application, class library(ies), added Web Deployment Project.
Add a new Web Setup ...
-
Hello, a common question on the ASP.NET Forum is:
How to define an Event Handler for a HyperLink?
The solution as follows:protected System.Web.UI.WebControls.HyperLink HyperLink1;
private void Page_Load(object sender, System.EventArgs e)
{
HyperLink1.Attributes.Add(''onClick'',
...
-
Hello:
Suppose you open a Modal Dialog window inside your ASP.NET page. In that dialog window, you have a GridView, DataGrid, or whatever control. Do some changes on that control, you will see that the data has changed right?
Ok, then close the dialog window, then open it again from the ASP.NET Page, you will see the old data and not the ...
-
A very common question on the ASP.NET forums is:
How to define an event in a UserControl, and process this event in the Page holding this UserControl?
The answer is simple, follow this post, and you will be able to define your own events very easily.
We have the following UserControl file together with the Code Behind as follows:
<%@ ...
-
I'm working those days on an application, which relies a lot on TreeView Control in ASP.NET 2.0. However, it is not just working with it out of the box, I am forced to go down and program with the control.
However, I was trying to traverse a Tree and thought of sharing with you this piece of code:
private void ...
-
I read a great post from some time, that Microsoft has decided to make the Visual Studio 2005 Express Editions free for ever!!
Read more here:
Visual Studio Express Editions are Free Forever
Regards
-
I wanted to share with you a great website I passed by today:
ASP.NET 2.0 Training Center
Has lots of great resources through articles, webcasts, and others.
Make sure to visit that site.
Regards
-
This post assumes you have the previous post on the DataObjectTypeName and ObjectDataSource .
Usually, when we want to allow paging when we are using ObjectDataSource, we should enable paging in both the Data-Bound Control (GridView an example) and the ObjectDataSource.
GridView: AllowPaging and off course you need to set ...
-
For most of you using the ObjectDataSource, you must have passed by DataObjectTypeName property of the ObjectDataSource.
I have been working with it for a while, but thought of sharing with you the beauty of that property.
Usually, ObjectDataSource uses two modes to pass parameters for the data mapper's methods:
Simple Data Types (string, int, ...
-
In my research on Localization in ASP.NET 2.0, which is my topic of the next Community Night Session at Microsoft Office in Beirut, I passed by the <asp:Localize> control in ASP.NET 2.0.
This control inherits from the Literal Control. It is mainly used to display static text on a web page that is to be localized.
You might say, a Literal ...
-
If you are working with either a new custom server control or a normal web user control, this is the proper way of adding an event that can be handled by the parent control of the child control you are develping:
Add the following to the control (Server Control / Web User Control ) being developed: #region Event Handler
private static readonly ...
-
Hi:
While working on a project having MasterPages, Content Pages, TreeView Controls, Themes, etc ... I was faced with the following situation:
In one of the master pages in my application, I had a TreeView, and a custom menu, in a sense, once a button is clicked in that menu, two things shall happen:
Redirect to another page
Populate the ...
-
This is a nice summarized sample code on how to format DateTime instances:// This code example demonstrates the String.Format() method.
// Formatting for this example uses the ''en-US'' culture.
using System;
class Sample
{
enum Color {Yellow = 1, Blue, Green};
static DateTime thisDate = DateTime.Now;
public static void ...
-
As you know, mostly developersdo place the connection string inside the web.config file. Sometimes, we need to use a username/pwd in the connection string and not only use Trusted Connection. It is always recommended to protected those areas inside your Web.Config especially when they include sensitive data.
In ASP.NET 2.0, it is so easy to ...
-
There has been always a popular question on the ASP.NET forums about the difference between CurrentCulture and CurrentUICulture. I wanted to distinguish things in this post and make it clear once and for all.
CurrentCulture and CurrentUICulture are both of type CultureInfo which is part of the System.Globalization.
CurrentCulture and ...
-
I had a question from a friend of mine at work, he's using the DataList with the XmlDataSource. He wanted to get the Top X records fro the XML file to show them in the DataList, so here is a simple way of doing so I found after doing some search online:
XMLDataSrouce:
<asp:XmlDataSource DataFile=Path to XML File'' ...
-
A very nice feature of MasterPages in ASP.NET 2.0 is the ability of the ASPX page to detect the browser and render a specific MasterPage for the specific browser.
How is that done? As follows:
<%@ Page Language=''C#'' Mozilla:MasterPageFile=''MozillaMasterPage.master'' ie:MasterPageFile=''IEMasterPage.master'' ... %>
As you can see, we ...
-
While working with the HttpContext.Current.Server.MapPath(), I discovered something which is that, the MapPath method starts seeking a path Starting from the current directory you are in and not directly from the root directory.
Hope this hint helps,
Regards
-
I have been working on a Global Error Logging & Handling solution for a web application that is part of a huge system we have been developing in my company.
I used an HttpModule to get attached to the Application_Error event, where I instantiate my own error handler classes and process the error. The processing is done though ...
-
Sometimes there is a need to do some action on a field returned from the database and displayed inside a TemplateField inside the DataGrid or GridView columns.
For example, you might have an email address inside your database and you want to set the HREF of the a tag as a link with the ''mailto:'' appended at the beginning of the ...
-
I have always misunderstood the difference between NULL and DBNULL until recently while I was working on ASP.NET web application, and was talking to a Webservice and I found an exception coming from one of the web methods inside the Webservice which is using the SqlCommand.ExecuteScalar() method.
What happens when the ExecuteScalar() method is ...
-
When you developer an ASP.NET web application or a DotNetNuke application, you will be having all types of file extensions:
.csproj
.cs
.vb
.su
.sln
etc ...
So, imagine you are developing a huge web application or even a DotNetNuke website and now it is time to deploy your application. Are you going to go through each single folder in ...
-
ASP.NET HOW DO I Video Series: Caching (Part 1)
This video is part one of a two-part series introducing the new caching features of ASP.NET 2.0. Start with a demonstration of Page Output Caching followed by an overview of the new ASP.NET 2.0 Database Caching support for SQL Server 2000 and SQL Server 2005. Topics include using the ...
-
There is a very nice module on Security Patterns in ASP.NET (1.x/2.0).
You can check it at: Security Training Modules
Hope that helps,
Regards
-
Sometimes in an ASP.NET (1.x/2.x) webform, we might have a Password TextBox, and one of the DropDownLists or RadiobuttonLists or any control present inside the web form might do a postback before you need to submit the form.
Every time this happens, I loose the Password TextBox value. A solution that might help you preserve the Password ...
-
You can now download the Ebay Starter Kit from: http://developer.ebay.com/windows/starterkits/
There is also an article at MSDN that helps you start your way with that starter kit, check it at:
Introduction to the eBay Selling Starter Kit
Hope that helps,
Regards
-
In the last few days, I was working on a Custom DotNetNuke Module, which is called ContactUs, which I will be using in one of the projects currently under my hands.
I wanted to list all entries of the ContactUs form that are stored in the database. So I decided to use the DataList, in which I place my own Table inside the ItemTemplate.
There are ...
-
I am working on a Custom DotNetNuke module. I wanted to have a DropDownList of all the countries in the world.
I had to google a little bit to find all the countries available, which I beleive are 222 countries.
I wanted to share with you the SQL Script I created.
You can download this script from the Files Area.
When you run this script using ...
-
Hello:
I was working last night around 3:00 AM, and I found out that in my GridView Column's list, I have added a TemplateField of type LinkButton with CommandName=”EditRec”, in such a way, when the Edit link button is clicked, I want to access the selected GridViewRow, then populate a web form on the same page, and without having to show the ...
-
I would like to share with you the following two links, which I beleive are good and useful.
String Formatting in C#
Url Rewriting with Regex for ASP.NET 2.0
Regards
-
I found a nice article today on MSDN titled as:
Turning an .ascx User Control into a Redistributable Custom Control
I will summarize as much as possible of that article, since it is really a valuable one.
It talks about creating your own UserControls, then converting them into CustomControls.
Create a New Web Site in Visual Studio 2005 (I guess ...
-
You can now download a set of Code Snippets to use in your C# development.
Please check this link for more information: Visual Studio 2005 Code Snippets
Regards
-
ASP.NET 2.0 ships with a set of providers for different features. We have the profile, membership, personalization and other new features that require a set of database tables and stored procedures, which are known as Application Services Database.
Usually when you create a new web application in ASP.NET 2.0 using either Visual Studio 2005 or ...
-
In ASP.NET 1.1, we used to bind a ListControl or any other control inheriting from it to some source of data, after that we used to add a new item at location 0 to tell the user to choose a value, like : -- Choose a Value --
We always had to do so AFTER binding the ListControl to its data source, else the binding will remove all ...
-
Have you ever faced that error before?
I have started development lately on a Windows 2003 Standard Server, having both VS.NET 2003 and VS.NET 2005 installed.
I was trying to open a DotNetNuke project yesterday and got the error by VS.NET 2003:
Error while trying to run the project : Unable to Start debugging on the web server. You ...
-
In my work today, I faced a very weird thingy, here it is:
I was retreiving a bit column from the table whose default value is set to 0, and then using an SqlDataReader, and the weird thing is that I used:
1- (bool)reader[col]2- Convert.ToBoolean(reader[col]])3- reader.GetInt32(col)
Nothing worked ...
-
A new and cool feature in ASP.NET 2.0, that allows you to import default namespaces once in the Web.Config file, and then every ASPX page (Not Code-Behind) can see those imported namspaces. Here is a small code:
<?xml version=''1.0''?><configuration> <system.web> <pages buffer=''true'' ...
-
There is a new ASP.NET 2.0 Security Wiki in Town, go and check it:
http://channel9.msdn.com/wiki/default.aspx/SecurityWiki.ASPNET2SecurityFAQs
Regards
-
When I start a new project, I usually create a Blank Solution in VS.NET, then add to it my Class Libraries and Web Application. The problem I used to have before is that, every time I did some changes in one of the Class Libraries I had to update the references manually to all other projects referencing that updated Class Libraries.
Thank to ...
-
I kindly invite you to check my latest article on the www.aspalliance.com, with the title of:
Code Snippets in Visual Studio 2005
Hope you enjoy it.
Regards
-
If you want to change the Cursor when the mouse is over the GridView, follow the simple steps below:protected void RowCreated (object sender, GridViewRowEventArgs e)
{
e.Row.Attributes.Add(''onMouseOver'', ''this.style.cursor='n-resize''');
}
Hope that helps,
Regards
-
I want ot point you to two important links on Extending GridView, by Frerik Normen:
1- http://fredrik.nsquared2.com/print.aspx?PostID=186
2- http://fredrik.nsquared2.com/print.aspx?PostID=177
Hope that helps,
Regards
-
You can call a custom method inside the TemplateField of the GridView as follows:
<TemplateField>
<ItemTemplate>
<%# GetSum((int)Eval(“Number1“), (int)Eval(“Number2“)) %>
</ItemTemplate>
</TemplateField>
public string GetSum(int num1, int num2)
{
...
-
I had today to work with some DateTime calculations.
I need two methods:
1- Get time difference between two dates, in such a way to have the following formats in the returned value:
- Hours
- Minutes (01 -> 1 minute, 10 -> 10 minutes,...)
- Seconds
- Hours.Minutes
- Hours:Minutes:Seconds
2- Add a double value for a DateTime
- double ...
|
|
|