background preloader

Misc

Facebook Twitter

How to write to an event log by using Visual C# This step-by-step article shows you how to add your own entries to the operating system's event log by using the Microsoft .NET Framework. Requirements The following list describes the recommended hardware, software, network infrastructure, and service packs that you will need: Microsoft Windows 2000 Professional, Windows 2000 Server, Windows 2000 Advanced Server, or Windows NT 4.0 ServerMicrosoft Visual Studio C# Write to an event log Event logging provides a standard, centralized way for your applications to record important software and hardware events.

Windows supplies a standard user interface for viewing the logs, the Event Viewer. Complete code listing using System; using System.Diagnostics; namespace WriteToAnEventLog_csharp { /// Summary description for Class1. class Class1 { static void Main(string[] args) { string sSource; string sLog; string sEvent; sSource = "dotNET Sample App"; sLog = "Application"; sEvent = "Sample Event"; if (! How to download large files in ASP.NET Visual Studio .NET. There are many ways to do this; Using Response.WriteFile u can easily download a large fileUsing streame: i.e. by using Response.BinaryWriteAllow direct access to that fileUsing an ISAPI filter Direct Access The most obvious approach to delivering a file across the Internet is to place it in a directory accessible by a web server.

How to download large files in ASP.NET Visual Studio .NET

Then anyone can use a browser to retrieve it. As easy as that sounds, there are a number of problems that make this alternative unworkable for all but the simplest of applications. More flexible access control mechanisms run into similar problems. Advanced Site Functionality - ASP.NET 2.0. ASP.NET Advanced Site Functionality In this tutorial you will learn advanced site functionality, Enhanced Page Framework, To create the Web.Sitemap file, Tracking Traffic with Site Counters and Going Mobile.

Advanced Site Functionality - ASP.NET 2.0

Enhanced Page Framework. ASP.NET ASHX Handler Tutorial. Some ASP.NET files are dynamic.

ASP.NET ASHX Handler Tutorial

They are generated with C# code or disk resources. These files do not require web forms. Instead, an ASHX generic handler is ideal. It can return an image from a query string, write XML, or any other data. Tutorial First, we review the goal of using ASHX files in the ASP.NET web development framework. Url example Getting started. Then:Select the "Generic Handler" item, and you will get a new file with some code in it called Handler.ashx. Autogenerated code What purpose does the autogenerated code in the ASHX file have? Tip:You should not change the interface inheritance or remove either of the members. Mappings It is often desirable to map an older URL or path to your new ASHX file. Tip:To do this, use urlMappings.Alternatively you can use more complex RewritePath methods.

Part of Web.config file: XML <system.web><urlMappings enabled="true"><add url="~/Default.aspx" mappedUrl="~/Handler.ashx"/></urlMappings> ... 100% Table Height. Occasionally designers may want to center content in a web page and they want it centered both horizontally and vertically.

100% Table Height

The traditional method for doing that is to put the content into a table and to assign a values of 100% to the table's HEIGHT attribute and center to the ALIGN attribute. Recently, that approach has become more problematic. You may have used this before and had it work but now, for some reason, new pages you create won't center vertically. You may be changing pages from standard HTML to XHTML and now tables don't respect the 100% HEIGHT attribute.

Basics of Cookies in ASP.NET. Mike Pope Visual Basic User Education Microsoft Corporation January 2003 Summary: Explains how to read and write HTTP cookies in an ASP.NET Web application using Visual Basic. (18 printed pages) Applies to ASP.NET Microsoft® Visual Studio® .NET Web Forms Level: beginning Web programmer Contents Introduction Cookies provide a useful means in Web applications to store user-specific information.

Basics of Cookies in ASP.NET

This article provides an overview of working with cookies in ASP.NET applications. What Are Cookies? A cookie is a small bit of text that accompanies requests and pages as they go between the Web server and browser. Compression - Create Zip archive from multiple in memory files in C# ASP.NET Cookies Overview. A cookie is a small bit of text that accompanies requests and pages as they go between the Web server and browser.

ASP.NET Cookies Overview

The cookie contains information the Web application can read whenever the user visits the site. For example, if a user requests a page from your site and your application sends not just a page, but also a cookie containing the date and time, when the user's browser gets the page, the browser also gets the cookie, which it stores in a folder on the user's hard disk. Later, if user requests a page from your site again, when the user enters the URL the browser looks on the local hard disk for a cookie associated with the URL. If the cookie exists, the browser sends the cookie to your site along with the page request. Your application can then determine the date and time that the user last visited the site. Test-Driven Development with Visual Studio 2010. ASP.NET ASHX Handler Tutorial.