Tuesday, December 30, 2008

Server Error in '/' Application ... A potentially dangerous Request.Form value was detected ...


When entering a value with angled brackets into a text box on a .NET application the following error is generated in the browser:

Server Error in '/' Application.

A potentially dangerous Request.Form value was detected from the client (TextBoxN="...")


The .NET framework is throwing up an error because it detected something in the entered text which looks like an HTML statement. The text doesn't need to contain valid HTML, just anything with opening and closing angled brackets ("<...>").

The reason behind the error is as a security precaution. Developers need to be aware that users might try to inject HTML (or even a script) into a text box which may affect how the form is rendered. For further details see www.asp.net/learn/whitepapers/request-validation/.

This checking was not performed in the .NET 1.0 framework and was introduced with the .NET 1.1 framework.


The remedy is in two parts and you MUST action both:

  1. To disable request validation on a page add the following directive to the existing "page" directive in the file - you will need to switch to the HTML view for this:


    for example if you already have:

    <%@ Page Language="vb" AutoEventWireup="false" Codebehind="MyForm.aspx.vb" Inherits="Proj.MyForm"%>

    then this should become:

    <%@ Page Language="vb" AutoEventWireup="false" Codebehind="MyForm.aspx.vb" Inherits="Proj.MyForm" ValidateRequest="false"%>

    Alternately, you can globally turn request validation off (but in which case be sure to implement item two below). To globally turn request validation off add the following to your web.config file:

    this should go within the section. This will turn off request validation for every page in your application.


    With request validation turned off, users will be able to enter html into text boxes on the page. For example entering:


    will be rendered by the browser (when the form is updated and the contents redisplayed) as JavaScript and a message box will appear with the message "Oops!". This is generally considered to be undesirable!

  2. Unless you actually need users to be able to enter HTML you must convert the string to its html encoding equivalent - basically this means that certain characters (like "<") are converted to codes (so "<" is converted to "<"). To perform this conversion use HttpUtility.HtmlEncode, for example:

    MyLabel.Text := HttpUtility.HtmlEncode(MyTextBox.Text);

    You only need to consider this for any text that will be rendered in the browser.

These notes are believed to be correct for .NET 1.1 and .NET 2, and may apply to other versions as well.

From: http://www.cryer.co.uk/brian/mswinswdev/ms_vbnet_server_error_potentially_dangerous.htm

Friday, December 19, 2008

Debugging client JavaScript in VS 2005

Client Java Script is one of the most important things in web development but not the best and easiest to develop. Building of bigger and more complicated scripts, especially using DOM model or form field values can cause a lot of frustration and head pain. Moreover, JavaScript debugging is not easy and obvious as should be. But there is a hope.

One of less known features of Visual Studio 2005 is Script Explorer, hidden in Debug menu where appears only when the debugger is running. This great tool allows easily debug JavaScripts.

Before start, we should ensure that client script debugging is not disabled in IE as it is by default. Suitable options are located on Advanced tab of Internet Options where both script debugging checkboxes should be unchecked.

We can come back to Script Explorer. As it was written before, it appears only while the debugger is working. So after starting project we can go do Debug->Windows where should be Script Explorer. Sometimes, don’t know why, it doesn’t so in this case we have to find it manually. Staying in debug mode right click on tool bar and go into Customize. Then select Debug in Categories on the left side of window and find Script Explorer on the right. Just drag it to Debugging toolbar.

After opening Script Explorer panel we will se the tree of active JavaScripts. At the first level are scripts that are imported from external sources or embedded in the page. There are also auto-generated scripts like postback scripts as well. By double-clicking on the selected script it will open in the main window.

At this moment, we can debug it in well known way using breakpoints, steps, Watch and QuickWatch, just like in the server side, including context variable browsing.

Breakpoints can also be set up in external *.js files before project will be loaded. Then, after loading project, the breakpoint will be activated by debugger. Note, that it is only possible to *.js files not for scripts embedded in pages. These scripts are available for debugging only after loading page.

Taken from:

Tuesday, November 25, 2008

How to delete a row in the DataTable (solution) .

How to delete a row in the DataTable (solution)

The VS .NET / ADO .NET documentation is very poor in the parts about deleting rows from the table. It should tell you the following, but it doesn't.

Let's say you want to delete a record. You read the help, and you write something like:


or, you write something like:


which is equivalent to the code above.

All is good and well. You have deleted the row from the data table. Now, you want to update the physical database, and you call the Update method.

BZZZZZZZT! Wrong answer! The database rows won't be deleted at all!

What you need to do (and the MS documentation doesn't tell you - just check in the parts about RemoveAt, Delete, Update - it is nowhere to be found) is:

row.Delete(); // mark row for deletion

...Update(); // update the physical database

table.AcceptChanges(); // remove the rows marked for deletion from the dataset

Microsoft, please update your documentation! You could easily put this in the help pages for Delete(), RemoveAt(), or Update()!

Thank you very much!

taken from: http://discuss.fogcreek.com/dotnetquestions/default.asp?cmd=show&ixPost=1950

Wednesday, August 20, 2008

How do I – Solve the “Could not create type WebService.Name” error when trying to deploying a web service?

OK, so you wrote a web service and you may even have tested it and everything worked fine. So the you did some "cleanup" and tried to deploy the web service. It compiles and deploys just fine, but when you try to invoke and hit the service you are presented with the following error:

Server Error in '/' Application.

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not create type 'WebServices.Candidates'.
Source Error:

Line 1: <%@ WebService Language="C#" CodeBehind="Candidates.asmx.cs" Class="WebServices.Candidates" %>

Source File: /Candidates.asmx Line: 1

So just how do you solve this problem?

Here's my checklist of things to check when having trouble deploying web services:

  1. Check that IIS is using ASP.NET 2.0.

    1. Begin by starting up the Internet Information Services manager.
    2. Expand "Web Sites".
    3. Expand your web site e.g. "Default Web Site".
    4. Locate the Virtual Directory to which the web service was deployed and right click it.

    1. On the popup menu, click "Properties".
    2. On the Properties window, select the "ASP.NET" tab.
    3. Ensure that the APS.NET Version is set to 2.0.x and not 1.1.x.
    4. If it is set to 1.1.x, set it to 2.0.x and retry your web service.
  2. Ensure your Visual Studio build properties are set correctly.

    1. Locate the .asmx file in your Solution Explorer pane and right click it.

    1. On the popup menu, click "Properties".
    2. Ensure that the Build Action is set to "Content".

    1. Locate the code behind (.cs or .vb) file in the Solution Explorer and right click it.

    1. On the popup menu, click "Properties".
    2. Ensure the Build Action is set to "Compile".

    1. If either of these weren't set correctly, make the correction, recompile, redeploy and retest.
  3. Ensure ASP.NET 2.0 is an Allowed web services extension.

    1. Open the IIS Manager.
    2. Expand your computer.
    3. Click the "Web Service Extensions" option.
    4. In the right hand pane, locate the "ASP.NET v2.0.x" entry and ensure that its Status is "Allowed". If it is not allowed, the "Allow" button on the left will be enabled. Click it to change the setting.

    5. If it was not allowed, correct the setting and retry your service.
  4. Check for the WebMethod attribute.

    1. Review your code and ensure that you have the [WebMethod] attribute set for all web methods in the service. This does not mean that all methods have to be web methods, but the ones you are trying to consume should have this attribute in its declaration.

  5. Ensure the .asmx and code behind file match definitions.

    1. Open your code behind (.cs or .vb) file.
    2. Look at the web service declaration at the top.

    1. In our example, ensure that #2 and #3 match. If they don't, correct the problem.
    2. Next note the namespace at #1.
    3. Now open the .asmx file. This can usually be done by double clicking it in the Solution Explorer, but if you're not able to get it to open through the IDE, open Windows Explorer, navigate to the file, right click it and select Open in Visual Studio to work around the problem.
    4. Now look at the code.

    1. Note the value of Class in this case is "WebServices.Candidates". The Class value should be the full namespace value as well as the class name. Given our code behind file's values, in this case, the Class value should have been "Crowe.PartnerNomination.WebServices.Candidates", but instead it is just "WebServices.Candidates". This is a common issue when reworking already written web services into a namespace hierarchy. For some reason the .asmx file does not always reflect the changes made which then causes the error message at the beginning of this post.
    2. Change the Class value, recompile, redeploy and retest.

    Taken from: http://www.cjvandyk.com/blog/Lists/Posts/Post.aspx?ID=133

Tuesday, August 5, 2008

Visual Studio 2005 Tools for Office, CommandBarButton FaceId Property

From http://www.kebabshopblues.co.uk/2007/01/04/visual-studio-2005-tools-for-office-commandbarbutton-faceid-property/
I recently started experimenting with Visual Studio 2005 and Visual Studio Tools for Office (VSTO) 2003. This entry is a technical .Net / VS2005 / VSTO blog and will probably not be of interest unless you use these tools yourself.

Yuck. Office applications allow many configuration / add-in options programmatically which are quite impressive, but do not sit well with other .Net development tools. For example, in Forms development, if we want to create a Button on a form programmatically, we declare a new Button(). In VSTO, we declare a new CommandBar, and then have to use the CommandBar.Add() method to create a new button on that toolbar.

One of the first things that I wanted to achieve - after adding a basic toolbar to Outlook 2003, was to add buttons with icons. It was frustrating that this was a topic that seemed to be omitted from the book ‘Visual Studio Tools for Office: Using C# with Excel, Word, Outlook, and Infopath’ (Carter and Lippert), and it almost entirely eluded me as to how to do it. There was the CommandBarButton.FaceId property, useful if you wanted a preset icon on your button (but no apparent documentation of what numbers should be used for which icons). Then there were the Picture and Mask properties that appeared to have relevance to this task, but I could not fathom how to use them. Web searches demonstrated some approaches, even on MSDN, that required the use of the clipboard to load an image; something that could muck up the user’s clipboard and therefore highly undesirable, it seemed to me.

Anyway, I finally found what I needed, on MSDN itself. This was one occasion when a generic web search with Google did not outperform Microsoft’s own site (prior poor recommendations that I had found turned out to refer to previous versions of .Net or VSTO).

But still in all my searches I failed to find documentation of the simplest way of assigning an icon to a button or menu entry, using the FaceId property. Possibly, I missed it; that would be easy in amongst the morass of documentation.

This blog documents the numbers and associated icons as discovered from using the various FaceId numbers in Outlook. I have not yet cross-checked the icon numbering with different applications. Lower down this page, I’ll comment briefly on how I got these images later in the document.

The Icons

The number to the right of the icon is the appropriate FaceId to use:































How I Made These Images

MSDN Support had a very tempting page which refers to ‘Finding FaceID Numbers for Your Microsoft Office 97 Toolbars’; but that text is not linked and does not retrieve anything on a search; though the text suggests that it (should have been) a tool to provide documentation of these FaceId’s in an Excel spreadsheet. Tempting, therefore, but fruitless (even if it referred to past versions, perhaps it might have helped?)

So, I wrote a little piece of code to create an Outlook toolbar with 104 buttons (the first 4 buttons being repeated, so there were 100 unique faceId’s), each with a FaceId and a text caption of the number used to achieve the icon. Making the Outlook window very narrow (so only the first four buttons were displayed) meant that clicking on the toolbar expansion button gave a drop-down with 100 unique buttons on. A bit of jiggery pokery with a screen-shot gave the necessary images. It was a pain to be such a manual process, but there you go; sometimes these things can’t be helped… I did decide to stop at 2999 though ;)

Maybe my OCD will cut in soon though and compel me to find the last icon…

[Added 24/1/07: I have now added a post with FaceId’s 3000 - 3999 for your enjoyment.]

Tuesday, July 29, 2008

Outlook Programming: how to find the parent message for a reply or forward message.

I'm currently involved in developing Outlook add-in. During that I've faced the problem how to find the parent message for a reply or forward message. The idea is that all messages in a conversation have the same ConversationTopic value, while the ConversationIndex is increased by 5 bytes with each change. Here is the sample that uses a MailItem named lastMailItem and searches the Inbox for a matching parent item.

MAPIFolder inbox = m_applicationObject.Session.GetDefaultFolder(OlDefaultFolders.olFolderInbox);
Items inboxItems = inbox.Items.Restrict("[ConversationTopic] = " + "\"" + m_lastMailItem.ConversationTopic + "\"");

string str = m_lastMailItem.ConversationIndex;
string convIndex = str.Substring(0, str.Length - 10);
foreach (MailItem item in inboxItems)
if (item.ConversationIndex == convIndex)
// Item is found, add your code here!!

Hope this will help you lot's.

Resolving the issue of those using MSN Messenger (Error Code: 80072745)

A lot of people are experiencing problems with MSN Messenger, especially the latest version. MSN Messenger 8, also known as Messenger Live!
I expeirienced this problem myself, relating to Error Code: 80072745. It was a pain in the ass, it became rather annoying that I could not sign in.
I kept getting the following message “We were unable to sign you in to the MSN Messenger, possibly because of a problem with your Internet connection. Please try again later. 80072745″
I began to try signing in to an online messenger service, such as http://webmessenger.msn.com, I was able to sign in fine, so blaming the server was out of the question.
If you are experiencing this problem, I sugest you try the following steps.

In my personal case the problem was is Eset NOD32 Antivirus, and I simply removed MSN from it's Web access protection list.

(Before you do the following steps, be sure that your Anti-Virus is fully updated, and you have run a full system scan for viruses/trojans.)
1: If you are using a Firewall, be sure that MSN Messenger has been granted access.
2: Clear your Internet Explorer’s Cache and Cookies. — Open Internet Explorer, click on Tools>Options. Delete Files and Delete Cookies. (If you are using something different, Mozilla Firefox, they can be found in the Privacy TAB).
3: MSN Messenger is required for “Use SSL 2.0″ and “Use SSL 3.0″ are enabled. — Open Internet Explorer, click on Tools>Options. Go to Advanced, scroll down and check them both.
4: Final step, Go to Start>Run and type in cmd and press enter. Then enter the commands below one by one, and then press enter for each command:regsvr32 softpub.dll( A message will appear, click ok. Then type in the next command, and repeat)regsvr32 wintrust.dllregsvr32 initpki.dllregsvr32 MSXML3.dll
After doing this, restart your Modem/Router, then try to sign in. If you are still unable to sign in, restart your computer.
Sometimes spyware/addware can be the problem, I recommend that you use Spybot - Search and Destroy. Click here for the Spybot website.
If you need any more information, feel free to contact me. martin@martinjknight.com
Please note that this information was taken from a well known source and was not created by me.
Here is another way of possibly resolving the problem, which was posted by internet-kaltersia. You may want to try this out if the previous information didn’t work.
Here is the crazy thing I had to do to fix this…
Quote from Raphael
Dear all if you have not heard simply add these addresses to the following file that should be opened with notepad and MSN will work.
C:\WINDOWS\system32\drivers\etc\hosts - (When you open the ETC folder open the HOSTS file using notepad).
insert the following addresses: messenger.hotmail.com65.54.239.80 dp.msnmessenger.skadns.net
Easy done … good luck.
Thank you for that additional information!

Please note that this information was taken from a well known source and was not created by me.

Monday, July 7, 2008

How to check for hidden/system files and folders.


Maybe not everybody knows how to check whether file or folder is hidden/system.
This code returns array of FileInfo and DirectoryInfo objects.

FileInfo[] info = dirInfo.GetFiles();
DirectoryInfo[] dirs = dirInfo.GetDirectories();

They both have Attributes property which is flag enum. So you can use this property to check for files attributes. Here is sample method to check whether object has hidden or system attributes:

private static bool IsNotHiddenOrSystem(FileAttributes attributes)
return (attributes & (FileAttributes.Hidden FileAttributes.System)) == 0;

Full list of file attributes can be found on MSDN site:

Enjoy ;)

Saturday, July 5, 2008

DynamicControlsPlaceholder - A placeholder that saves its child controls


ASP.NET gives a developer the opportunity to programmatically add controls to a web form using ParentControl.Controls.Add(new Control());
However, these controls are not persisted in any way thus having to be recreated for each subsequent request.


To create a control that behaves like a placeholder but additionally handles recreating dynamic controls on subsequent requests.


I have created a custom control called DynamicControlsPlaceholder that derives from Placeholder and overrides Load- and SaveViewState.
In SaveViewState, the control hierarchy is recursively traversed and the control type and ID persisted to a string
In LoadViewState the persisted information is used to recreate the control tree to the state before.

Download (V2.2):

From: http://www.denisbauer.com/ASPNETControls/DynamicControlsPlaceholder.aspx

Friday, July 4, 2008

What's the difference between Bind and Eval

Data-binding expressions are contained within <%# and %> delimiters and use the Eval and Bind functions. The Eval function is used to define one-way (read-only) binding. The Bind function is used for two-way (updatable) binding. In addition to calling Eval and Bind methods to perform data binding in a data-binding expression, you can call any publicly scoped code within the <%# and %> delimiters to execute that code and return a value during page processing.
Data-binding expressions are resolved when the DataBind method of a control or of the Page class is called. For controls such as the GridView, DetailsView, and FormView controls, data-binding expressions are resolved automatically during the control's PreRender event and you are not required to call the DataBind method explicitly.
Using the Eval Method
The Eval method evaluates late-bound data expressions in the templates of data-bound controls such as the GridView, DetailsView, and FormView controls. At run time, the Eval method calls the Eval method of the DataBinder object, referencing the current data item of the naming container. The naming container is generally the smallest part of the data-bound control that contains a whole record, such as a row in a GridView control. You can therefore use the Eval method only for binding inside templates of a data-bound control.
The Eval method takes the name of a data field and returns a string containing the value of that field from the current record in the data source. You can supply an optional second parameter to specify a format for the returned string. The string format parameter uses the syntax defined for the Format method of the String class.

Using the Bind Method
The Bind method has some similarities to the Eval method, but there are significant differences. Although you can retrieve the values of data-bound fields with the Bind method, as you can with the Eval method, the Bind method is also used when data can be modified.
In ASP.NET, data-bound controls such as the GridView, DetailsView, and FormView controls can automatically use the update, delete, and insert operations of a data source control. For example, if you have defined SQL Select, Insert, Delete, and Update statements for your data source control, using Bind in a GridView, DetailsView, or FormView control template enables the control to extract values from child controls in the template and pass them to the data source control. The data source control in turn performs the appropriate command for the database. For this reason, the Bind function is used inside the EditItemTemplate or InsertItemTemplate of a data-bound control.
The Bind method is typically used with input controls such as the TextBox control rendered by a GridView row in edit mode. When the data-bound control creates these input controls as part of its own rendering, it can extract the input values.
The Bind method takes the name of a data field to associate with the bound property.

Wednesday, July 2, 2008

More information about ASP.NET Page life-cycle and common events

I’ve found wonderful document about ASP.NET Page lifecycle events on http://john-sheehan.com/blog. Little information about general page Life-cycle stages and events:

The whole document can be found here: http://john-sheehan.com/blog/wp-content/uploads/aspnet-life-cycles-events.pdf . There is also information about Data Binding Events for Data-Bound Controls and Common Life-cycle Events.

Enjoy :)

Monday, June 30, 2008

Tooltip in ASP.NET GridView headers

I was searching for the way show Tooltips for headers of ASP.NET GridView control without using javascript or using unnecessary overhead in code. And I found the way how to do it. When you define columns or your GridView you should use TemplateField instead of BoundField cause it's customizable. In TemplateField you can define HeaderTemplate and put there Label control with needed Tooltip. Here is the code:

<asp:GridView ID="GridView" DataSourceID="ObjectDataSource1" runat="server" AutoGenerateColumns="False" >
<asp:TemplateField SortExpression="ShareCount">
<asp:Label runat="server" Text="Nr. of Stocks" ToolTip="Total number of stocks on the market"></asp:Label>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("ShareCount") %>'></asp:Label>

.NET Format Strings

I've found great pdf document about .NET Format Strings.

Here is the sample from it.

Full document can be downloaded from John Sheehan blog :

Sunday, June 29, 2008

ASP.NET data binding essentials

<%# %> Syntax

ASP.NET introduces a new declarative syntax, <%# %>. This syntax is the basis for using data binding in an .aspx page. All data binding expressions must be contained within these characters. The following list includes examples of simple data binding from multiple sources:

• Simple property (syntax for a customer):
<%# custID %>

• Collection (syntax for an order):
<asp:listbox id="List1" datasource="'<%#">' runat="server">

• Expression (syntax for a contact):
<%# ( customer.First Name + " " + customer.LastName ) %>

• Method result (syntax for the outstanding balance):
<%# GetBalance(custID) %>

In the preceding examples, the inline <%# %> tags indicate where the information from a specific data source is to be placed in the .aspx page. The following data binding example uses a TextBox Web server control: <asp:textbox id="txt" text=="<%# custID %>" runat=server />

For more information about data binding syntax, see the following .NET Framework Software Development Kit (SDK) documentation:
Data Binding Expression Syntax

Friday, June 27, 2008

WPF Beginners Guide

Sacha Barber is the great man who writes lot's of the great articles about WPF. Here is the series of his articles for beginners in WPF:

WPF: A Beginner's Guide - Part 1 of n
WPF: A Beginner's Guide - Part 2 of n
WPF: A Beginner's Guide - Part 3 of n
WPF: A Beginner's Guide - Part 4 of n
WPF: A Beginner's Guide - Part 5 of n
WPF: A Beginner's Guide - Part 6 of n

I hope this will greatly help many of you and you'll get main concepts and basics of this wonderful technology. Here is his blog: Sacha Barber blog

VS 2005 Error 1: "Could not load type..."

You can receive this error "Could not load type" error message in your ASP.NET Application, when you browse to .aspx page by using Visual C# .NET or running from local IIS.


When you browse to an .aspx page, you may receive one of the following error messages:
Could not load type 'Namespace.Global'.
Could not load type 'Namespace.PageName'.


These errors occur if the .aspx page or the Global.asax page contains a reference to a code-behind module and if the application has not been built.


Use one of the following methods to build the application:
• Use the C# command line compiler (CSC.exe) to run the following command:
csc /t:library /r:System.web.dll /out:mydll.dll myfile.cs
• In Microsoft Visual Studio .NET, click Build on the Build menu.

NOTE: Microsoft Visual Basic .NET background compiles the project as soon as it is created. Because Visual C# .NET projects only background parse, you must explicitly build the application.

Steps to Reproduce the Behavior

1. Start Visual Studio .NET.
2. On the File menu, point to New, and then click Project.
3. Click Visual C# Projects under Project Types, and then click ASP.NET Web Application under Templates.
4. Right-click WebForm1.aspx, and then click View in Browser.

Materials are taken from http://support.microsoft.com/kb/306155

Wednesday, June 25, 2008

SQL Error "INSERT Failed" When You Update Table Referenced in an Indexed View

When you run a stored procedure or SQL INSERT statement directly, which attempts to insert a row into a table that is referenced in an indexed view, the following error may occur:
INSERT failed because the following SET options have incorrect settings: 'ARITHABORT' Furthermore, this error may occur even if "SET ARITHABORT ON" is included in the batch or stored procedure that attempts the INSERT.

To successfully insert a row into a table that is referenced in an indexed view, the SQL ARITHABORT configuration setting must be set to ON. Furthermore, the statement that applies this configuration setting must be executed in its own batch. Because stored procedures contain only one batch, adding the statement to the procedure does not work.

My own solution was to rebuild stored procedures and indexed used with the table you are updating.

To resolve this problem, add the following ADO code to your application after you open the connection to your database: MyConnection.Execute "SET ARITHABORT ON"
where MyConnection is a reference to the ADO connection object you are using to run the stored procedure that performs an INSERT or the SQL INSERT statement.

Material taken from: http://support.microsoft.com/kb/305333

Tuesday, June 17, 2008

New Employer

I've left Artfulbits Inc, and now I work for Euroland in Estonia as ASP.NET Developer.

Sunday, June 1, 2008

HTTP pipeline in ASP.NET 2.0.

Today I will provide you with a short reference for the steps in HTTP pipeline in ASP.NET 2.0. Some of the steps are internal and can't be subscribed by HTTP modules or global.asax:

1. Internal step to validate request. Protects against malicious attacks exploiting path canonicalization
2. Internal step to perform URL mapping (if the URL mapping feature is enabled)
3. Fire BeginRequest event
4. Fire AuthenticateRequest event
5. Fire DefaultAuthentication internal event
6. Fire PostAuthenticateRequest event
7. Fire AuthorizeRequest event
8. Fire PostAuthorizeRequest event
9. Fire ResolveRequestCache event
10. Fire PostResolveRequestCache event
11. Internal step to determine the IHttpHandler to process the current request (this is when the page compilation takes place)
12. Fire PostMapRequestHandler event
13. Fire AcquireRequestState event
14. Fire PostAcquireRequestState event
15. Fire PreRequestHandlerExecute event
16. Internal step to execute the IHttpHandler (call its ProcessRequest method) for the current request. The handler is determined at step #11
17. Fire PostRequestHandlerExecute event
18. Fire ReleaseRequestState event
19. Fire PostReleaseRequestState event
20. Internal step to perform response filtering (only if HttpResponse.Filter is installed)
21. Fire UpdateRequestCache event
22. Fire PostUpdateRequestCache event
23. Fire EndRequest event. This is the only event that is guaranteed to be fired for each request

I've found this info in Dmitryr's blog and took it from another topic, but this info will be valuable also.

Monday, May 26, 2008

ASP.NET 2.0 Directives


Today I've decided to write about ASP.NET 2.0 directives. There are 11 of them. Here is a full list of directives:

DirectiveAttributesShort description
Imports assembly with given name into page or control
@ControlThe same as Page hasApplied for properties setting while creating custom controls
@ImplementsInterfaceSpecifies that page's class implements this interface
@ImportNamespaceImports given namespace
@MasterThe same as Page hasApllied for specifying Master Page template. New in ASP.NET 2.0
Gives strongly typed reference on class contained in Master Page. Gives opportunity to reference class properties.
Controls Page or Control caching. See msdn for details.
@PageDescribed belowAttributes refering current Page.Used only if files with .aspx extension.
Page, which was used for user data sending. New in ASP.NET 2.0.
Page or Control that should be compiled with current.
Associates aliases with namespaces and class names for notation in custom server control syntax.

@Page Directive

The @Page directive enables you to specify attributes and values for an Asp.Net Page to be used when the page is parsed and compiled. Every .aspx files should include this @Page directive to execute. There are many attributes belong to this directive. We shall discuss some of the important attributes here.

Language: This attribute tells the compiler about the language being used in the code-behind. Values can represent any .NET-supported language, including VB.NET, C#, or JScript .NET.

AutoEventWireup: For every page there is an automatic way to bind the events to methods in the same .aspx file or in code behind. The default value is true.

CodeFile: Specifies the code-behid file with which the page is associated.

Title: To set the page title other than what is specified in the master page.

Culture: Specifies the culture setting of the page. If you set to auto, enables the page to automatically detect the culture required for the page.

UICulture: Specifies the UI culture setting to use for the page. Supports any valid UI culture value.

ValidateRequest: Indicates whether request validation should occur. If set to true, request validation checks all input data against a hard-coded list of potentially dangerous values. If a match occurs, an HttpRequestValidationException Class is thrown. The default is true. This feature is enabled in the machine configuration file (Machine.config). You can disable it in your application configuration file (Web.config) or on the page by setting this attribute to false.

Theme: To specify the theme for the page. This is a new feature available in Asp.Net 2.0.

SmartNavigation: Indicates the smart navigation feature of the page. When set to True, this returns the postback to current position of the page. The default value is false.

MasterPageFile: Specify the location of the MasterPage file to be used with the current Asp.Net page.

EnableViewState: Indicates whether view state is maintained across page requests. true if view state is maintained; otherwise, false. The default is true.

ErrorPage: Specifies a target URL for redirection if an unhandled page exception occurs.

Inherits: Specifies a code-behind class for the page to inherit. This can be any class derived from the Page class.

There are also other attributes which are of seldom use such as Buffer, CodePage, ClassName, EnableSessionState, Debug, Description, EnableTheming, EnableViewStateMac, TraceMode, WarningLevel, etc. Here is an example of how a @Page directive looks

Monday, May 5, 2008

How to disable Vista UAC.


I've noticed that Vista UAC turned on automatically about 2 weeks(my work PC is in domain) ago and now I can't turn it off using Control Panel - it simply doesn't turns off. UAC irritates me highly and I've started searching the solution how to kill it :) And found one very usefull. UAC still works but doesn't display any messages :-))

You just need to create 2 keys in registry, here they are:
In [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]

Or if you want to turn it off totally simply change and reboot:

You can also use msconfig to do the same:
- Start - Run - msconfig - Tools -Disable UAC

Hope this will help other people.

Tuesday, April 29, 2008

ASP.NET 2.0 Web service problem

Today I've tried to publish my web service on aspspider.net. But I've faced the problem that I can't run the webservice method with following message: "The test form is only available for requests from the local machine". I've read some information and found out that you need to edit config file of your application and add there the following declaration to specify that an ASP.NET Web service can use HttpGet and HttpPost protocols to receive request data sent from a client and return response data.

<add name="HttpGet"/>
<add name="HttpPost"/>

Now it works perfect.

Thursday, April 17, 2008

Shareware software

I've just started to think about shareware software. I have some ideas of software implementation and I'll try to implement my ideas soon. The only thing that will have to do is to sell that software :-)

Thursday, February 28, 2008

Tuesday, February 26, 2008

My first SLR camera

Yesterday I've bought my first SLR camera Olympus E510.

It's really great camera, first impressions are cool!

Here is full review of the camera:

Wednesday, February 13, 2008