Top 10 Web Config Interview Questions

Web config interview questions and answers

Today, In this tutorial I am going to talk about web.config file and its uses, we will also talk about the FAQ of web config, which is asked in interview. As shown by the name "wen.config" it means web configuration. Where we can do custom configuration like URL Rewriting, Authentication and authorization, connection and all. So let's see how it works and the important question which is asked during the interview.

Top 10 Ceb Config Interview Questions

Some main work of web.config file

  • Custom error configuration (for 404, 403, other error of application)
  • Database connection configuration.
  • Error handling.
  • Security.
  • Url rewriting.
  • Declaration of variables (key) -- For global use in the application.

Web config interview questions

Q.1) What is a web.config file.
Ans: Web. Config is an application configuration file of application which is written in XML Format. Every root directory has only one web config file. We can have multiple web config files in our application there is no restriction to use the web.config file.

Q.2) Does web.config file case-sensitive?
Ans: Yes.

Q.3) What is the format of the web.config file.
Ans: XML Format.

Q.4) Can the ASP.NET project run without a Web.config file?
Ans: Yes we can run.

Q.5) Can we have multiple web.config in one application
Ans: Yes, we can have multiple web config in one application, but one directory can contain only one web config.

Q.6) How you will configure the connection for the database in web config?
Ans: By adding the <connectionstring> </connectionstring> tag, later on we will configure our connection between these tag.

    <add name="mydatabasename" connectionString="Data Source=.;Initial Catalog=list4business;Integrated Security=true; timeout=10000;" />

In the above <connectionStringswe have multiple attributes in <add> tag. let's know about each part on the above connection line.
name is used for the connection name, later with help of this name we can call our connection string.
connectionString is used for the connection with the database (SQL, Oracle). In connectionString we have Data Source, Initial Catalog, Integrated security.

Q.7) Write the syntax of app setting in web config.
Ans: In App setting we can add values in key-value format and later on we can use it multiple times according to our requirement.

      <add key="registration_email_id" value="[email protected]" />


How to use appsetting in cs page of application.

string email_id = ConfigurationSettings.AppSettings["registration_email_id"];

Q.8) Can we set the startup page on the web.config file.
Ans: We can set startup page on web config by using some code. First, find the System.webserver in web config and write the following code within <system.webServer</system.webServer>

<defaultDocument enabled="true">
    <add value="index.aspx"/>

In the Above source code index.aspx will be your startup page.

Q.9) How to Use Web. Config customErrors for ASP.NET.
Ans: In application customErrors support mainly 3 types of modes.

I hope you like this "Web config interview questions". Please don't forget to comment below. If you found it to be helpful.

Read More

How to pass query string in hyperlink in asp net

Pass query string in hyperlink in asp net

Today, I am going to show with you "how we can pass query string in the hyperlink". So let's get started step by step tutorial of passing query string in the hyperlink. Many times a situation arrives when we need to pass query string from one page another page by hyperlink. If you want to use hyperlink with query string, also this tutorial will helpful for you.

How to pass query string in hyperlink in asp net, multiple query string in gridview

Step to implement the query string with hyperlink

1. Add an server-side hyperlink control.
2. Put the value and key in herf attributes.
3. URL of the page on which you want to redirect.

Use Single Query in hyperlink

  <asp:TemplateField HeaderText="View">
         <asp:HyperLink ID="HyperLink1" ForeColor="red" Text="view" Target="_blank"
       runat="server" NavigateUrl='<%#"StudentView.aspx?id="+Eval("StudentID").ToString()%>'></asp:HyperLink>

How to use multiple query string in hyperlink in in grid view

    <asp:TemplateField HeaderText="View">
            <asp:HyperLink runat="server" NavigateUrl='<%# string.Format("~/Details.aspx?StudentID={0}&StudentName={1}", (Eval("Empsalary").ToString()),
    (Eval("Empsalary").ToString())) %>' Text="View" Target="_blank"/>

If you have any issue, please drop a comment below. We will happy to help you.
Read More

How to execute function in sql with parameters - Solved

Execute function in SQL with parameters: In this tutorial, I am going to show with you how you can execute the function of SQL with parameter. We will also talk about the single parameter as well as multiple parameters. 

execute function in sql with multiple parameters


Make a SQL Function with parameter
2. Call it With select keyword

Let's See step by step process to execute SQL function with parameters. In the below function, I have a create a function which will find the date of birth. You can make any function but the function calling process will be the same.

Execute function in SQL with Single parameters

Create function age
@dob date
     declare @age int
     set @age=DATEDIFF(YEAR,@dob,GETDATE())-
         when (month(@dob) > month(GETDATE())) or
               (month(@dob) = month(GETDATE()) and day(@dob) > day(GETDATE()))
         THEN 1
         ELSE 0
     RETURN @age

select dbo.age('01/02/2014')
select dbo.age('01/02/2014') as age

Execute function in SQL with Multiple parameters

In below function, I have a created function which is used to count record from a table, In this function, you will see the use of multiple parameters.

Calling of SQL function with multiple parameters

  select DBO.Login('Sana',123)

Create a table and Insert some Record then make a function. Definitely, You will be able to understand better.

CREATE TABLE [dbo].[Mytbl]
          [Name] [varchar](20) Primary Key Identity,
          [PhoneNo] [int] NULL,
          [Gender] [varchar](5) NULL,
          [Pass] [int] NULL,
          [Address] [varchar](20) NULL

INSERT [dbo].[Mytbl] ([Name], [PhoneNo], [Gender], [Pass], [Address]) VALUES ('Sana', 9125, 'F', 123, 'Noida')
INSERT [dbo].[Mytbl] ([Name], [PhoneNo], [Gender], [Pass], [Address]) VALUES ('Sana', 9125, 'F', 123, 'Noida')
INSERT [dbo].[Mytbl] ([Name], [PhoneNo], [Gender], [Pass], [Address]) VALUES ('Sanjay', 8989,'M', 0, 'Noida')
INSERT [dbo].[Mytbl] ([Name], [PhoneNo], [Gender], [Pass], [Address]) VALUES ('Manu', 8978, 'M', 0, 'Gzbd')
INSERT [dbo].[Mytbl] ([Name], [PhoneNo], [Gender], [Pass], [Address]) VALUES ('Ram', 8958, 'M', 78945, 'Mayur Vihar')
INSERT [dbo].[Mytbl] ([Name], [PhoneNo], [Gender], [Pass], [Address]) VALUES ('Sanjay Yadav', 121,'M', 0, 'noida')
INSERT [dbo].[Mytbl] ([Name], [PhoneNo], [Gender], [Pass], [Address]) VALUES ('Ramesh ', 343, 'M', 23, 'AshokNagar')
INSERT [dbo].[Mytbl] ([Name], [PhoneNo], [Gender], [Pass], [Address]) VALUES ('Ramesh ', 343, 'M', 23, 'AshokNagar')

Create a function with multiple parameters

Create function [dbo].[Login](@n varchar(20),@pwd int)
returns int
       declare @temp int
             select @temp=count(*) from Mytbl where Name=@n and Pass=@pwd
             return @temp

  select DBO.Login('Sana',123)

Read More

23 Typescript interview questions and answers for beginners

Welcome to Typescript interview questions (pdf) and answers for beginners, Here are some tricky typescript interview question and answers collection which is asked in the interview. May it will help you to crack your typescript interview.

Typescript interview questions and answers for beginners
Typescript interview questions and answers

1. What is namespace in Typescript? Write the declaration of the namespace.

I think Everyone familiar with the namespace of other languages, here also in TypeScript a namespace is just a collection of classes by which we can logically categories. If we want to access any class from outside of the namespace then we need to export keyword.

namespace People
      export class Boss
      export class Employee
      export interface Iofficework


2. What is Typescript?

TypeScript is known as Object-oriented programming language developed and maintained by Microsoft. Which is provide you to optional parameters, classes, and interfaces.TypeScript is nothing but JavaScript and some additional features i.e. ES6 features. Whenever we compile the TypeScript code it first converts in JavaScript then it runs and we get output.

3.Difference between typescript and javascript?

1. Typescript is a superset of JavaScript whereas JavaScript is a scripting language.
2. Typescript has an interface concept but JavaScript havan't.
3.TypeScript doesn't run in the browser where JavaScript runs.
4.TypeScript has classes whereas JavaScript has functions.
5. Typescript support module whereas JavaScript doesn't support modules.
6. In typescript Number, a string is the interfaces whereas In, JavaScript Number, string are the Object.

4. What are the key features of typescript?

TypeScript supports different browsers or node.js versions and optimizes the resulting JavaScript. It is much easier to write clean, consistent code across a project and development team.

5.When to use a super keyword in typescript.

In typescript, Super keyword is used to reference base class properties and the base class constructor.

6.How to access static methods in TypeScript

7. What Are Classes In Typescript?

The concept of classes is very similar to .NET/Java. A Class can have constructor, member variables, properties, and methods. TypeScript also allows access to modifiers “private” and “public” for member variables and functions.

8. Tell me the command for installing typescript.

npm install -g typescript

9. What Are The Benefits Of Typescript?

TypeScript has the following benefits:

2Impose coding guidelines
3.Offers type checking
4. It helps in code structuring
5.Compile time error checking
6. Use class-based object-oriented programming

10. What is the typescript extension and how you compile?

Typescript extension is '.ts'. It is just a javascript file, when we compile typescript file, just after compilation it convert into '.js' file.

Step to compile a typescript program
1. tsc 'your typeScript File Name'
For example, to compile “program.ts”:
tsc program.ts

After compilation, you will get

11. How to declare a variable in Typescript?

var name:string="sham"
var phone:string="123456"

12. How do you declare an undefined variable?

var name:string;

var phone:int;

13. How to declare and initialize an array in Typescript?

var names:string[];       -- Declaration

names=["a","b","c","d"]   -- Initialization

14. How to achieve inheritance in Typescript?

15. How to make a module in Typescript?

16. What is the role of constructor in Typescript?

A constructor is responsible for initializing the variable of the class.

17. How to initialize the static variables?

class office
   static phoneNo:number=101;
   console.log(office.phoneNo) ;

18. What is the difference between var and let in Typescript?

1.var declaration done at function scoped and let declaration done at block scoped.
2.var allow you to re-declare the same variable in the same scope. whereas let will not

19.How to define a global variable in a typescript module.

20.How to export a variable.

export var demo = [1,2,3];

21. What is the role of var keyword in typescript?

var is key it helps us to create an object of a class.

22. How to Convert string to number in TypeScript?

   //convert string to number
   this.empcode = Number(name);

23. Can we debug Typescript file?

Yes, With the help of .js source map file.

24. What are the classes in TypeScript?

Typescript class is very similar to other languages like (.Net, Java). As we know that class can have constructor, member, variable and methods.

25. What are the benefits of Typescript?

1. ES7 and ES6 Features support.
2. User-friendly for Java and .Net programmer.
3. Intellisense.
4. Object Oriented programming support.

TAG: Typescript interview questions and answers for beginners, Typescript interview question and answers, beginner typescript question and answer

Read More