How To Insert Single Quote Into DB2

If you try to insert single quote into DB2 sql table directly, it will give an error message due to single quote is reserved for mark a string value in sql. It is not allowed to use escape sequence for single quote with sql. Below example is incorrect with sql syntax.

INSERT INTO CUSTOMERS ( COMPANY_NAME ) VALUES ('Nandun\'s Company')

Here middle single quote is not valid even it has used the escape sequence. The easiest method to insert single quote into sql table is replace single quote with double quote.

INSERT INTO CUSTOMERS ( COMPANY_NAME ) VALUES ('Nandun\"s Company')

In second example I have replaced the single quote with double quote, but once you execute this command it will insert single quote instead of double quote.

You can use following code in C#.NET to replace single quote with double quote.

Replace("\'", "\"")

If you have any question you can list them under comments section.

Crystal Report Toolbar Images Not Displayed In ASP.NET

If you have used Crystal Report (Crystal Reports 2008 Official Guide) with Microsoft ASP.NET, you might have face this issue many times. This is a common problem with Crystal Report deployment and many people don't have proper solution for the problem. Crystal Report Toolbar images not shown in deployed environment is one of the main inconvenient with the tool that is leaded many developers not to use Crystal Report tool as their reporting tool even though Microsoft Visual Studio distribute Business Objects Crystal Report Tools free of charge. Even though your report is perfectly working inside the report viewer, it is not useful if the report viewers toolbar is not working properly. You can not navigate through multiple pages, can not export your report, can not print the report...etc. So that it is equally important to work your report and report viewer both correctly to feel end user happy reporting experience.

Save Millions Of Dollars, Don't Pay For Graphic Tools


Are you a graphic designer, web designer or digital artists who is paying back most of your income for software tools that you are using for your creations? What will be your net income if you could save money that you are paying for those software tools? Yes, there are tons of free tools that you can use as alternative graphic software tool. Some of the free tools having rich set of functions than commercial tools, but most of the people are having lack of knowledge about them and their features. So, I decided to introduce few of them that I am using for my creations without paying any dollar for any company. That means cost for my creations are negligible and income is really high.

No More Database Programming Needed !

Are you tired in writing complex code for your database design? Want to be little relax? This article will help you to enjoy your job.

In early days we had to write coding from the scratch to implement our database designs. Later people moved to database designing graphical tools. The latest trend of designing databases is use database navigation maps where you can visually feel your database design. This method is very useful if your database is little complex and you have lot of key constraints, referential integrity constraints, indexes and triggers etc. Using database navigation maps you can see either the entire database or part of it, how the tables are integrate each other, what are the keys you have defined for tables and references etc. Most importantly you don't need to write any single code or no need to remember complex SQL syntax.

How To Validate XML Document With ASP.NET

In my previous article, we discussed on how to generate XML document or XML stream from your dataset. There I mentioned that one of the major advantage of converting a dataset into XML is we can easily validate our XML data against the XML schema. The XML schema is used to define the format, data types and key constraints that you want to validate. The XML document or XML stream can be validate against the predefined XML schema and exactly you can get the validation error and on which tag that error is occurred.

First you need to have a XML document to validate. There are several ways to convert your data into XML documents. In previous article I showed you one such method. In this article I will show you how to do a validation with XML schema for existing XML document.

Working With Dataset And XML In ASP.NET 2.0

XML data definition format is heavily used in nowadays applications since it is very rich data definition method. Working with XML data is very customizable, easy and reliable. Important features of XML language are;

  • well defined schema
  • purely character based data definition method
  • customizable tags
  • easy validation of XML documents
In ASP.NET it provides lot of shortcut methods to work with XML data. Actually .NET Frameworks most of the components fully based on XML languages. Few examples are Data Grid, Data Set and Class Designer etc. Due to this reason you can easily convert data in dataset to XML document and read data from XML document to feed into dataset. Why it is important to convert dataset into XML documents is a good question to analyze. There are few reasons to explain here, first thing is dataset is a kind of a special data format and not exchangeable with different applications. Transfer through web protocols is not straight forward with dataset, but XML data is based on characters and easily pass through the network. Most importantly validation of data is very easier with XML data that data in dataset. There are buit in validation functions with XML documents in ASP.NET.

How To Specify Unique Key/Primary Key Constraints In DB2

Using iSeries Navigator you can very easily specify Unique Key and Primary Key for database table in DB2 database. Most of the people are not well aware that DB2 is relational database and it support all the relational database concepts. I have experience that most of the developers are not using key constraints, referential integrity, triggers etc. But most importantly DB2 is support for all these features. Let's look at one by one how these concepts can be implemented using iSeries Navigator on DB2 database.

To create Unique Key or Primary Key for a given table you need to go the table definition. Right click on the table that you want to modify and add new key and select "Definition" option.

Fig 1: Table Definition Option

Crystal Reports in Microsoft Visual Studio 2005

With Microsoft Visual Studio 2005 you can develop applications with Crystal Reports without using separate Crystal Report application installed in the development machine. They have provided Crystal Reports tool in standard toolbox in Visual Studio 2005 environment. Simply you need to drag and drop these controllers and develop your reports same as previously with Crystal Report. Advantage is you don't need to buy separate Crystal Report application and install them in development and deployment environments.


Fig 1: Crystal Reports Tools in Microsoft Visual Studio 2005

How To Create Stored Procedures Using iSeries Navigator

In conventional method it is not very straight forward to write stored procedures with DB2 in AS400 environment. You might need to remember lot of syntax or might need to refer books to find syntax to code the procedures. This is very inefficient method for today's database programming context. iSeries Navigator has been provided very cool feature to develop your stored procedures from the iSeries Navigator graphical UI. You don't need to remember all the syntax to write database coding and the tool itself given you all the syntax which are required to write your coding. Only you have to do is insert them into your coding and make necessary modifications.



Login to your iSeries Navigator and browse your database that you want to create new stored procedure and select "Procedures" section.

Fig 1: Select you database and Procedures in iSeries Navigator pane
Right click on Procedures and select "New" to create new stored procedure. There are two options to select either "SQL" or "External" type procedure to create. If you select ""SQL" you can write your new procedure using SQL syntax. Also you can use separate external program written using C, C++, CL, COBOL, COBOLLE, PLI, REXX, RPG, RPGLE and Java by selecting "External" option. This is very flexible method since high level programming languages are provided much more freedom to code complex coding than SQL language. This article is focus on develop a procedure using SQL language.

Fig 2: Create new SQL type procedure
Provide procedure name, description, maximum number of result set, data access and specific name in General tab of "New SQL Procedure" window.
Fig 3: New SQL Procedure General Tab

In Parameters tab you can specify what are parameters for the procedure. Click on "Insert" button to add new parameter, once you added new parameter you can change its name, data type, length and In/Out option.
Fig 4: New SQL Procedure Parameters Tab

Next step is develop SQL logic for the procedure. For that select "SQL Statements" tab in New SQL Procedure window. In SQL Statements tab you will have "SQL Statements examples" drop down list, Insert button and Statements section. From drop down list select what is the syntax that you want to insert into your code. This drow down list will show all the required SQL syntax to develop your SQL code. Once you select the statement, click on Insert button to enter selected statement into your code. After inserting default statement you can modify as you wish. For example you can change variable names, data types etc. Advantage here is you don't need familiar with all the syntax, but you can simply insert them and modify according to your requirement. You can put any number of statements to build up your SQL code.
Fig 5: New SQL Procedure SQL Statements Tab
In the above example I have inserted variable initialization and alter table SQL code. You can modify this inserted default code like below example.
SET myCounter= 4;
ALTER TABLE Customer ADD COLUMN Age INTEGER;
In first line I have initialized the variable called "myCounter" to 4. In second line I have alter the Customer table and add Age column.
In this way very easily you can develop your SQL program for your stored procedure. This is very efficient method and very time saving. But initially you might need to get little familiar with tool. Good luck and happy coding !

How To Send An E-Mail Using ASP.NET

Sending an E-mail from your web site is really simple with ASP.NET. First of all will look at what actually happened when an E-mail is sending from a web site. First step is preparing your complete E-mail programmatically. For that you need to set source e-mail address, destination e-mail address, e-mail subject, e-mail body, SMTP (Simple Mail Transfer Protocol) mail server and SMTP port of your server. Once you prepare your E-mail in correct format, there is only one step to send the E-mail to your destination addresses. For that you need to pass the E-mail request to message queue of the SMTP server through SMTP port. By default port 25 is used as mailing port. That is only what you have to do and rest of the relaying of E-mail part will handle by the SMTP server itself. SMTP server is responsible to pass your E-mail to respective destinations.

System.Net.Mail namespace should import using following code.

using System.Net.Mail;

Code for prepare your E-mail format is as follows.

// System.Web.Mail.SmtpMail.SmtpServer is obsolete in 2.0
// System.Net.Mail.SmtpClient is the alternate class for this in 2.0
SmtpClient smtpClient = new SmtpClient();
MailMessage message = new MailMessage();

MailAddress fromAddress = new MailAddress(fromAdd, displayName);

// You can specify the host name or ipaddress of your server
// Default in IIS will be localhost
smtpClient.Host = "smtpsvr";

//Default port will be 25
smtpClient.Port = 25;

//From address will be given as a MailAddress Object
message.From = "fromadd@yourdomain.com";

// To address collection of MailAddress
message.To.Add("toadd@yourdomain.com";);

message.Subject = "Your E-mail subject";

// CC and BCC optional
// MailAddressCollection class is used to send the email to various users
// You can specify Address as new MailAddress("admin1@yoursite.com")
//message.CC.Add("ccadd1@yourdomain.com");
//message.CC.Add("ccadd2@yourdomain.com");

// You can specify Address directly as string
//message.Bcc.Add(new MailAddress("bccadd1@yourdomain.com"));
//message.Bcc.Add(new MailAddress("bccadd1@yourdomain.com"));

//Body can be Html or text format
//Specify true if it is html message
message.IsBodyHtml = false;

// Message body content
message.Body = "Your E-mail message contents";

// Send SMTP mail
smtpClient.Send(message);

How To Set Session Timeout in Web.config

Session timeout period can be set as you required simply changing web.config file of your web site. In ASP.NET web site once you add web.config file you can find tag. Inside this tag you can specify session timeout value. Add following code to your web.config file.

<system.web>
<sessionstate timeout="60"/>
</system.web>

In this example you have set sessionState timeout value to 60 minutes. You can change this value as you wish, but need to make sure that it is really required. For example if you set a very large value for timeout, your session will hang on forever in the server. This will lead some security issues, memory overflow issues and sometime unexpected behaviour of your web site. And also this value should not be very small values. For example if you have functions like uploading files in the web site, then you should give enough time to upload a file based on the size of the file, network traffic and bandwidth limitation of the client machine.

New Blog Site for Power Electronics and Robotics

I lanched a new blog site for discuss about power electronics and robotics related topics. This site is intended to publish deep theoritical articles and practically implementations of power electronics and robot world.

http://www.elecsl.blogspot.com/

Identity Columns in DB2 AS/400

Does DB2 support for identity columns? Yes, it is. All numeric data types in DB2 database support for identify columns. Identity columns means, a field or column in a database table which automatically set its values for a new row insert. You don't need to provide value for the identity field when you insert new row into your table. For example if you want to set your customer identification number grow like 1000,1001,1002,1003... , you can set customer identification number column as identity column and starting number 1000 and increment value is 1. Then when you insert next customer it will increase the maximum customer identification number by 1 and automatically insert into the table.

You can find iSeries Navigator from "Start -> IBM iSeries Access for Windows -> iSeries Navigator". Open iSeries Navigator and select your database and table that you need insert identity column. Keep in mind that you can only set identity only for numeric fields. You can either create new table with identity columns or set identity property for existing table.
Fig 1: Insert New Column with Identity
In Table go to Column tab and click on Add button to add new column. Specify column name, short name, data type text...etc. If you select numeric data type for you column you will see a check box "Set as identity column". Tick that check box to enable identity for this column. Once you check the check box it will expand the window which allow you to configure the identity settings.
Fig 2: Set as Identity Column

Set Increment to an any value that you want increment your identity value. If you set 1 here it will increase the existing maximum number by 1. Starting value is used to set increase first row. Minimum value and Maximum value are used to restrict the values to a particular range. Values to cache is used to load last maximum values to memory so that increase the maximum value by Increment value is not needed a database hit for read maximum value for the identity column. "Cycle values when the maximum or minimum value is reached" check box is used to set whether the repetative value range is necessary when the datatype is reached its maximum or minimum values. This option is not allowed if you have set the column as primary or unique key for the table. "Generate the values in the order requested" check box is used to set whether you need to set values for the column in order or not. For example if you delete any value in between the value range whether that value is reusable or not.
Once you set any column as identity you don't need to give values when you insert a record into table. This column will automatically will be filled by the DBMS itself.

Manage SQL Tables in IBM iSeries Navigator

IBM iSeries Navigator is a rich client tool to work with DB2 database in AS400 machines. From your Microsoft Windows client machines through iSeries Navigator you can connect to remotely located DB2 database and work with it as simple as work in Microsoft Access database. You don't need work with console or do lot of coding which always lead to errors. Using iSeries Navigator you can very quickly develop you database and manage it very effectively.

Login

First step is to login to AS400 machine through iSeries Navigator. You need to provide server name, user id and password.


Fig 1: Login iSeries Navigator

Once you successfully login to the system in "Environment" pane it will list down all the entities that you can manage through iSeries Navigator UI. This list will vary based on the access permission to the connected AS400 server. In this article will discuss on how to work with SQL tables through the Navigator. At the end of the article you will realize how you can save your time by using iSeries Navigator for database management rather working on console window.

Work with SQL tables in DB2 database through navigator you need to select "Databases" section. Under Databases section you will have Schemas, Database Navigator Maps, SQL Performance Monitors, SQL Plan Cache Snapshots and Transactions.



Fig 2: Databases in iSeries Navigator

Under schemas section it will list down all the database schemas or different databases in the server. Database Navigator Maps is a graphical tool to visualize the database design. It is shown database tables, constraints and relationships or references in graphical notations. Database Navigator Maps can be used to manage your database as well. SQL Performance Monitors can be used to monitor and fine tune the database design. Transactions section shows Database Transactions and Global Transactions.

Select Schemas to Display
Expand the Schemas section to see the database you have already in the server. If it not listed your particular database you can add that database to navigator by using "Select Schemas to Display" option. Right click on the Schemas and select "Select Schemas to Display".

Fig 3: Select Schemas to Display
Enter the schema name or search for a schema that you want to show in the navigator using "Select Schemas toDisplay" window. Add the schema to "Selected Schemas" list and click Ok.

Fig 4: Select Schemas to Display Window


Create New Schema
If you want to create a new database or schema, right click on Schemas and select "New -> Schema". Specify a name for the new schema, whether it needs to add to displayed list of schemas and create as standard library. "Create in" is the system pool that you want to create your database in. "Text" is to discribe shortly your database for operator's purpose.



Fig 5: New Schema Window

Create New Table
Once your database schema is listed under Schemas section, select the database that you want to work with. It will display all objects belong to the selected database such as aliases, constraints, distinct types, functions, indexes, journal receivers, journals, procedures, sequences, SQL packages, tables and views. Select "Tables" from the tree view and right hand side pane will display all the tables in the database. Right click on Tables and select "New -> Table" to create new table in the database.
Fig 6: Create New Table Window

In New Table window specify the table name, schema and system table name and text. System table name is used to identify the table in the system. Text is to describe the table purpose. Use "Volatile Data" check box if the table need to be volatile.
Add Column to Table
Fig 7: Create New Column Window
Specify Column name, Short name for system purposes, Data type, Text and Heading for new column. Data type drop down list shows all the data types that you can use for your purpose. Click "Add" once you enter all the details to add the column into table.

IBM iSeries Navigator

DB2 is one of the most popular Database Management System developed by IBM. DB2 is heavily used in various high end applications around the world on mainly AS400 platform. High security, higher performance, easy maintenance and backup/recovery procedure of DB2 are key factors to lead the industry. Even though DB2 is very powerful database management system, it was not very user friendly at early stages. Basically console based programming was required. Most of the users came from Microsoft Windows operating system background don't like to work on console and write everything manually. They always expect some graphical tool to make easy their work. IBM iSeries Navigator full fill this gap effectively and nowadays iSeries Navigator is heavily used desing and program database. Work with iSeries navigator is realy simple as work with Microsoft SQL server UI. iSeries Navigator is client tool that is allowed to work with your DB2 database remotely from your PC. Installing iSeries Navigator is really simple on Microsoft Windows operating system.
You can find iSeries Navigator from "Start -> IBM iSeries Access for Windows -> iSeries Navigator".
Fig 1: Open iSeries Navigator

iSeries Navigator is stand alone windows application which will facilitate almost all the services that can perform in DB2. This is very rich tool but most of the people are still not used effectively.

Fig 2: iSeries Navigator UI

iSeries Navigator main UI containts four major sections and a menu bar. Menu bar is not a complex one and any person can easily work with. Top left hand corner section called "Environment" section and it list down all the entities and services that you can use based on your permission level. Top right hand corner section shows the details for the selected entity of the environment section. "My Tasks" section list down all the possible tasks that can perform at DB2 server level. This list is not unique for all users and will vary based on the permission level that user have. "Environment Tasks" section list down all the task that can perform for the selected environment in environment section.

Common functions listing that can perform using iSeries Navigator is as follows:

  • Design and Create Databases
  • Create Database Schemes
  • Create Tables, Views, Stored Procedures, Functions, Indexes, Triggers and Journals
  • Create Users, User Groups and manage them
  • Manage Security
  • Basic Operations such as Messages, Printer Output, Printers and Jobs
  • Work Management - Manage Jobs, Queues, Subsystems and Memory Pools
  • Network Configuration
  • File System
  • Backup Policies
  • Application Developments

Will discuss one by one further in future articles.

Import/Export SSL Security Certificates in IIS

We discussed how to enable SSL in a web site and create your own self-signed security certificate. Also you can use exsisting security certificates for a same server and same domain. You can use "Import" and "Export" facilities in Actions pane of Server Certificates window.
Open IIS Manager browsing Start -> Control Panel -> Administrative Tools -> Internet Information Services (IIS) Manager or run "inetmgr" command. Click on "Server Certificates" icon in middle pane of IIS manager.
Click on "Server Certificates" icon.

Fig 1: Server Certificates Icon


Select your existing certificate from Server Certificates window. Once you select your certificate it will show few new links in Actions pane to Export the certificate.

Fig 2: View, Export or Remove links


View link is for view details of the selected certificate, Export link for export the selected certificate and if you no more required selected certificate you can click on Remove link to remove certificate from the server.


Fig 3: Export Certificate Window

Browse the location that you want to save your certificate at "Export to:" and provide a password for this file to secure the certificate containts from unauthorized users. You need to provide same password when you import the certificate back.
Click on "Import" link and browse your certificate file to import.

Fig 4: Server Certificate Window

Fig 5: Import Certificate Window

Create Self-Signed Certificates in IIS

While you have freedom to use security certificate from third part organization, for simple applications you can use self-signed certificates in IIS. With self-signed security certificates there is no third party is involved for certification or validation process. You can generate self-signed certificate in IIS (Internet Information Services) Manager and use the same for your HTTPS enabled or secure site. Open IIS Manager browsing Start -> Control Panel -> Administrative Tools -> Internet Information Services (IIS) Manager or run "inetmgr" command. Click on "Server Certificates" icon in middle pane of IIS manager.

Fig 1: Server Certificates Icon
Click on "Self-Signed Certificate" link in Actions pane.

Fig 2: Server Certificate Pane


Specify the friendly name for your certificate in "Create Self-Signed Certificate" window and click Ok.



Fig 3: Create Self-Signed Certificate
Finally you can bind the generated self-signed certificate to your secure SSL site by using "Bindings" link in actions pane for a selected web site.

How To Setup HTTPS Enabled Web Site

HTTP (Hypertext Transfer Protocol) is the normal web protocol that define how to browse a web site's content using its domain name. In HTTP data transmission between client machine and web server machine as means of plain text streams. Any person in between client machine and web server machine can read these information transfer through. If the data transmission should be secured and only authorized persons should be readable then it is needed to follow few steps further. There are several ways that can implement security for a website such as introduction of authorization/authentication methods, SSL (Secure Socket Layer), VPN (Virtual Private Network) etc. These methods have pros and cons with regards to the charasteristics. By implementing these techniques together we would be able to secure the site's contents further.

SSL (Secure Socket Layer) is used to transfer data between web server machine and client machine as encrypted data stream. SSL enabled websites should operated only on HTTPS protocol. These websites we called as HTTPS enabled or secured website. To implement SSL on our website we need to take security certificate from trusted third party organization. Verisign, COMODO, Thawte, Equifax, Go Daddy, Entrust and GeoTrust are leading SSL secure certificate providers. It is needed to select the correct secure certificate for your purpose and budget. You can concentrate on following while you are selecting a security certificate.
  1. Your budget
  2. Your purpose whether you need very high security or medium security
  3. Web server using
  4. Operating system that the web server is running
  5. Encryption algorithm
  6. Private Key size (normally 1024/2048)
  7. Warranty that they provided

Once you decided from which provider you are purchasing a certificate you need to follow few steps to complete the installation of certificate in the web server.

Step 1:

Before you install SSL security certificate you need to buy a commercial certificate or get a free test certificate. Free test certificates are only for testing purposes only and they are not allowed to use for commercial purposes. Before purchase or download test certificate you need to generate CSR (Certificate Server Request) from your web server. This request is contained all the necessary details to process a security certificate for your server. Please keep in mind that this certificate server request should generated only from the machine that your are going to install the certificate.

Open IIS Manager (Internet Information Services Manager) by browsing from Control Panel or run "inetmgr" command. Select the server name from left side pane. Double click on "Server Certificates" icon.


Fig 1: Server Certificate Icon


In "Actions" pane you will see few options such as Import, Create Certificate Request, Complete Certificate Request, Create Domain Certificates and Create Self-Signed Certificates.

Fig 2: Server Certificates window

If you have already installed security certificates are there it will down in server certificates list. To create new certificate server request click on "Create Certificate Request" link. It will open "Request Certificate" window.

Fig 3: Request Certificate window

Fill all the required details as of your domain and complete the form. At the end of the window it will asked a location to save your certification request. You can give any name for this file. Keep this file till you purchase your security certificate since it will ask the content of this file for certificate generation process.

Step 2:

Next step is to purchase your commercial certificate or download test certificate. Go to the site official web site of the security certificate provider you have been selected. Complete the security certificate apply forms and when it asks for CSR (Certificate Server Request) you should copy the content of CSR file you generated in step 1. When you are coping the content of this file, open that file only using plain text editors like notepad. Never use rich text editors like Ms-Word since it might add some additional characters. If everything success complete the certification application process and you will end up with the certificate generated for you by the certification authority. Final step is to install the purchased or downloaded certificate in your web server.

Step 3:
Fig 4: Complete Certificate Request window

From step 2 you will get a certificate file which is having extension as ".cer". Once you have this certificate file click "Complete Certificate Request" link in Actions pane. In "Complete Certificate Request" window browse your certificate and provide friendly name for easily identify the certificate among other installed security certificate in the server. Complete this window and you will get successfully installed your security certificate in your server.

Step 4:

Once you successfully installed security certificate in your web server next step is to bind the certificate with your particular web site. In one server there might have more than one certificates installed. You should specifically set which certificate should use by your web site. For that in IIS Manager select your particular web site and click on "Bindings" link in Actions pane. By default you will have only HTTP binding for a web site. You should add HTTPS binding and specify which security certificate or SSL certificate to use from the certificate drop down list.

If everything done you have successfully setup your HTTPS enables or Secured web site. Now browse your web site from your browser and see the progress of your work. Please make sure that you are typing "https://" not "http".

What is SSL?

SSL stands for Secure Socket Layer. It uses HTTPS (Hypertext Transfer Protocol Secure) protocol instead of general HTTP protocol. HTTPS is a combination of the Hypertext Transfer Protocol and a network security protocol.

HTTP operates at the highest layer of the TCP/IP Internet reference model, the Application layer; but the security protocol operates at a lower sublayer, encrypting an HTTP message prior to transmission and decrypting a message upon arrival.

HTTPS has also been known as "Hypertext Transfer Protocol over Secure Socket Layer", but now HTTPS may be secured by the Transport Layer Security (TLS) instead of Secure Sockets Layer (SSL) protocol.

To invoke HTTPS, one replaces "http://" with "https://" in the URI, or Web address.

HTTPS connections are often used for payment transactions on the Web and for sensitive transactions in corporate information systems.

Set Default Document For A Website

Normally if the website's starting page is named as index.htm, index.html, default.aspx etc once you type your domain name in the address bar of the web browser it is able to browse the corresponding starting page. You don't need to specify the starting file name and extension. If your website's starting page is other than common use such as login.htm, login.aspx etc it not straight forward to resolve the starting page for a given website. For that you need to specify the default document for the website IIS using "Default Document" feature.





Fig 1: Default Document Icon

Browse the website that need to set the default document in "Connections" pane of IIS Manager. Double click on Default Document icon to specify the default document for your site.




Fig 2: Default Decument window in IIS 7.0

Click on "Add..." link to add new default document to the site. You can see in the figure there are two types of documents are listed. "Inheretted" items come from server level default documents and "Local" type entry is the specifically entered for this website.

HTTP Redirect in IIS 7.0

Using your domain name or DNS (Domain Name Server) entry you can redirect your users to the web server that the website is hosted on. But if you have several websites in one server or several application in one website the users might need to specify the exact location of the page that they need to browse. This is not very cleared design since most of the users are willing to type less on the address bar and browse what they want. You can use HTTP Redirect feature in IIS Manager (Internet Informations Services Manager) to overcome this problem. Your domain name or DNS entry will push your users into the webserver and from there you can redirect them to the specify location or page by using HTTP Redirect feature. There you need to specify the destination that need to redirect.



Fig 1: HTTP Redirect in IIS 7.0

"Redirect requests to this destination" text box can be used to specifyt the destination of the redirection. Once you specify the destination url click on "Apply" link in Actions pane to save the settings.

Apache web server is support to IP based redirection that allowed you to specify diffent IP for the diffirent website in the web server and DNS can redirect based on the IPs of the websites. But so far IIS web server doesn't support for this featrue. So that you might need to use this featrue to redirect your users to exact location.

Restrict A Website for specific IP address on IIS 7.0

Generally websites are open for public users. Public websites can be accessed from any PC connected to the Internet whereas someother sites request to authenticate the user to provide service. Within a public domain there might have secured sites such as HTTPS enabled sites, VPN etc. Apart from these categories you can restrict your website to be browsed only from specific PCs only. IPv4 Address and Domain Restrictions feature in IIS can be used to deny or allow access to specific IP address or IP address range.


Fig 1: IPv4 Address and Domain Restrictions

In Actions pane you are allowed specify the allowed entries and denied entries. There you can specify one IP address or range of IP addresses. If you are specify the Allow Entry and Deny Entry both for one website, you need to make sure that the IP address ranges are not conflict with each other.



Fig 2: Add Allow Restriction Rule













Fig 3: Add Deny Restriction Rule

FeedReader - Free RSS Reader Software

FeedReader is free RSS reader software. You can download this software on following link:

http://www.feedreader.com/download

RSS (Really Simple Syndication) is a family of Web feed formats used to publish frequently updated works. By using feedreader software you can download all the feed updates from your favourite sites into your computer. By simply browsing only one application you can read various articles from different RSS web sites.

How to Show/Insert HTML and other tags in Blogger

If you have try to show or insert HTML or other tags into Blogger post, you might have seen that those text are not visible once you publish your post. The reason is once you insert HTML tags, blogger is render them as meta tags. So you can not see them and what you have written there will be rendered and show the resutl. To avoid this and show HTML and other codes in your post you need replace your code, greater than sign with & g t; and less than sign with & l t;.


Plese not that remove spaces in between three characters. What is actually happened here is & l t and & g t are another method of tell HTML page to show greater than and less than sign.

HTTP 413 Request Entity too Large - Can't upload large files

HTTP 413 Request Entity too Large - Can't upload large files

If you are tring to upload a file using file uploader in IIS6 ro IIS7 normally HTTP request is allowed to upload upto file size 2 MB. But when you are using file upload feature with CAC (client access certificates) the SSL preload is used a new metabase property called UploadReadAheadSize in IIS6 or 7 to determine the maximum buffer size of the incoming request. The default size for this buffer is 48k, which was added to prevent anonymous DOS attacks by uploading very large garbage files.

Simply you can increse this thresold value to avoid this problem. You can change this setting up to 4GB although you probably wouldn't want to do so unless you had a compelling business need. Of course a site that required authentication would be an effective way of limiting the chances of DoS, so if you do need to up this limit, you should consider requiring client authentication to connect.

Use following scripts to change the uploadreadheadsize:

cscript adsutil.vbs set w3svc/1/uploadreadaheadsize 204800

If you get following error, you need to install adsutil.vbs script in your machine. or you can run this command from the location of the script.

Microsoft Windows [Version 6.0.6001]Copyright (c) 2006 Microsoft Corporation. All rights reserved.
C:\Users\Administrator>cscript adsutil.vbs set w3svc/1/uploadreadaheadsize 204800Microsoft (R) Windows Script Host Version 5.7Copyright (C) Microsoft Corporation. All rights reserved.
Input Error: Can not find script file "C:\Users\Administrator\adsutil.vbs".

Search "adsutil.vbs download" to get the lates script from the web.

Increase Upload File Size in IIS 7.0

I developed a ASP.NET web application that can upload around 2 MB files from client location to server folder. This application was working fine in my test environment on IIS 7.0. But once I moved that application into my web server which had MS-Windows 2008 server and it gave me an error saying that file size is too high to upload file. Which is requred to increased the "maxAllowedContentLength" and "headerLimits" size. Inserting below code into your web config file you can specify these parameters.

<requestfiltering>
<requestlimits maxallowedcontentlength="2097151">
<headerlimits><add header="Content-type" sizelimit="2097151">
</headerlimits>
</requestlimits>
</requestfiltering>

Also you can increse "maxRequestLength" in httpRuntime tag using following code part.

<httpruntime apprequestqueuelimit="100" minlocalrequestfreethreads="4" minfreethreads="8" usefullyqualifiedredirecturl="false" maxrequestlength="2097151" executiontimeout="1200">

LinkWithin

Related Posts with Thumbnails

Twitter Updates

    follow me on Twitter