Friday, April 26, 2013

What is the use of web.config file?

0 comments Posted by Rahul Kharde at 3:19 AM
Web.config file is the main settings and configuration file for an asp.net web application. the file is an xml document that defines configuration settings and information regarding the web application. It can be considered as one of the most essential part of a web application.

web.config used
1.       Database connection string
2.       Session state configuration
3.       Application language and compilation settings
4.       Security configuration
5.       Contains information that control module loading
6.       Tracing
7.       Error Handling
Read More »

Different ways for store database connection string in asp.net ?

0 comments Posted by Rahul Kharde at 2:34 AM
We can store the connection string as follows

1) Web.
config 

2) Universal data link (
UDL) file (only for OLEDB.Net data provider)

3) Window registry


4) Custom file


5) Com+ catalog


6) Encrypt or Decrypt Connection Strings in web.config 
Read More »

Thursday, April 18, 2013

IDENTITY_INSERT in SQL Server

1 comments Posted by Rahul Kharde at 4:32 AM
This command is to enable the users to set their own value for IDENTITY Column in case they want to.  Using the setting of SET IDENTITY_INSERT is OFF it is possible to insert our own value into the IDENTITY Column.

Syntax as follows

SET IDENTITY_INSERT tablename ON
SET IDENTITY_INSERT tablename OFF

Let consider the below example

Create table Student with an identity column

CREATE TABLE [dbo].[Student]
(
    [StudentID]       INT NOT NULL IDENTITY(1, 1),
    [StudentName]  VARCHAR(100) NOT NULL
)

Insert record into the table 

INSERT INTO Student(StudentName) VALUES ('Name 1')
INSERT INTO Student(StudentName) VALUES ('Name 2')
INSERT INTO Student(StudentName) VALUES ('Name 3')
INSERT INTO Student(StudentName) VALUES ('Name 4')
INSERT INTO Student(StudentName) VALUES ('Name 5')

Let delete the record no 3 and 4

DELETE FROM Student WHERE StudentID=3
DELETE FROM Student WHERE StudentID=4

we try to insert record at no 3 position

INSERT INTO Student(StudentID,StudentName) VALUES (3,'New Name 3')

it shown error

Msg 544, Level 16, State 1, Line 1
Cannot insert explicit value for identity column in table 'Student' when IDENTITY_INSERT is set to OFF.

First Set IDENTITY_INSERT as ON and insert the record with Identity column. It will allowed to insert the Identity column value

SET IDENTITY_INSERT Student ON

INSERT INTO Student(StudentID,StudentName) VALUES (3,'New Name 3')
INSERT INTO Student(StudentID,StudentName) VALUES (4,'New Name 4')

SET IDENTITY_INSERT Student OFF

SELECT * FROM Student




Read More »

ASP.NET Authentication

0 comments Posted by Rahul Kharde at 3:45 AM

What is Authentication?

Authenticating a user on a website means that you verify that this user is a valid user, that is, verifying who the user is using username/password or certificates, etc

Authentication knows the identity of the user

Authentication verifies who you are

Example: When you login to access some site then your logon credential (userid/password) identifies

There are three ways of doing authentication and authorization in ASP.NET

Windows based Authentication:

When you are providing access to the resources based on the network level login then it is called as “Windows based Authentication”.

The windows based authentication is applicable only towards private website of the organization i.e. intranet based implementation.

Credentials are stored in the Web server s local user database or an Active Directory 

domain
. Once identified you can use the user s credentials to gain access to resources that are protected by Windows authorization
 

Form based Authentication:

Using forms authentication we can decide certain users can access only certain pages or we can control the anonymous access, we can implement folder level access and roles.

When u want to provide access to the resources based on the credentials provided with custom login page then it is called as “Form Based Authentication

The custom login page will be designed by the developer and credentials can be verified with the database server.

When client makes a request to the webpage other than “Login.aspx”, the web server will respond with Login page. Once the user submits proper credentials, web server will respond with requested webpage along with security token.

The security token will be sent to the client system in the form of cookie. This will act as an identity for the user for sub sequent requests.

The form based authentication is applicable for the public website i.e. internet level implementation.


Passport Authentication:

Passport authentication identifies a user with using his or her e-mail address and a password and a single Passport account can be used with many different Web sites. Passport authentication is primarily used for public Web sites with thousands of users. 

Passport authentication is an authentication for collection of Websites, so it is called as “Single sign on Service”.

The major problem with this Authentication is users’ information will be under the control of Microsoft.

Passport authentication relies on a centralized service provided by Microsoft.







Read More »
 

Popular Posts

Recent Comments

© 2011. All Rights Reserved | Help to understand .Net | Template by Blogger Widgets

Home | About | Top