0% found this document useful (0 votes)
464 views21 pages

Question Multiple Choices

The document discusses scenarios where validation should be included when developing forms. It provides the following key points: 1. Validation should be used when saving diary entries to ensure at least one field is populated. 2. Validation is recommended when a form passes personal information to an external company, even without requirements, to ensure minimum data criteria is met. 3. Validation makes sense for a multi-step financial aid application since fields may be incomplete at times due to the process. 4. Validation of maximum field lengths should be applied to a home brewing form to prevent data loss in the database. All the scenarios listed require validation to be implemented.

Uploaded by

Asheke Zinab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
464 views21 pages

Question Multiple Choices

The document discusses scenarios where validation should be included when developing forms. It provides the following key points: 1. Validation should be used when saving diary entries to ensure at least one field is populated. 2. Validation is recommended when a form passes personal information to an external company, even without requirements, to ensure minimum data criteria is met. 3. Validation makes sense for a multi-step financial aid application since fields may be incomplete at times due to the process. 4. Validation of maximum field lengths should be applied to a home brewing form to prevent data loss in the database. All the scenarios listed require validation to be implemented.

Uploaded by

Asheke Zinab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

1. In which of the following scenarios should you include validation?

(Choose all that


apply.)

 A. You have an online diary with two form fields, a title, and a large subject box. A title is
not required, and the subject content is stored in a database column with no maximum size.
 B. The web application you maintain has an area that serves as a pass-through to another
company’s web services. The form contains personal information, such as address and phone
number, and is used to set up a profile on the company’s retirement partner website. The partner
has never given you any instructions as to what is or is not required to be sent to them.
 C. Your application is a long wizard that college students use to apply for financial aid.
They do not have access to the application until they are already logged on to the system so the
application knows who they are. Most students will log on many times to finish the application,
so any field might or might not be completed at any time.
 D. You are developing a simple form that helps home brewers keep track of their process.
The form provides two input fields: Date/time and ph level. The Date/time box needs to be an
ordinary text box because people around the world might enter the date differently, in a way
that is meaningful to them. The ph level can be either a numeric value or a text description.
 Answer:
 ABCD
 Explanation
 A. Correct: You should build in validation to check that at least one field has been
populated before saving an entry.
B. Correct: Although the partner company has not provided any requirements, your
company is responsible for data entry and therefore should ensure that the data passing
through the application meets some minimum criteria.
C. Correct: The application has many entry fields so it is difficult to predict when an
entry hits a valid stage. However, you already know you have constraints on the data
being input because of the size of the database columns in which you will be storing
them. A MaxLength validator on each field would help ensure that there is no loss of
data.
D. Correct: Although either field in the form can be anything, they should have a
maximum length limit imposed so the data does not exceed the size of the database
column they will be stored in. You should also validate that neither field is empty.
You want to support the Internet Explorer, Firefox, and Opera web browsers in your application.
Which vendor-specific extensions do you need to include with CSS3 properties? (Choose all that
apply.)

 A. -webkit-
 B. -ms-
 C. -o-
 D. -hp-
 E. -moz-
Hide Answer
Answer:
BCE
Explanation
A. Incorrect: The -webkit- prefix is used for Google Chrome and Apple Safari.
B. Correct: The -ms- prefix is used for Internet Explorer.
C. Correct: The -o- prefix is used for the Opera browser.
D. Incorrect: The -hp- prefix is used by Hewlett-Packard.
E. Correct: The -moz- prefix is used for Mozilla Firefox.

2. You are creating an ASP.NET MVC web application. The application accepts phone
number input through the application’s form. When viewing the source from a browser,
you find the following code:

PhoneNumber: <input id="phoneNumber" name="phoneNumber" size="10" type="text"


value="" />

What Razor syntax code segment was used?

 A. PhoneNumber: <input id="phoneNumber" name="phoneNumber" size="10" type="text"


value="3125551212" />
 B. <div class="editor-field">

@Html.EditorFor(model => model.PhoneNumber)

</div>

 C. PhoneNumber: @Html.TextBox("phoneNumber", Request["phoneNumber"], new {


@placeholder = "3125551212" })
 D. PhoneNumber: @Html.TextBox("phoneNumber", Request["phoneNumber"], new { size
= 10 })

Answer:
D
Explanation
A. Incorrect: The Value construct sets the display information in the element. In addition, the
field is not bound to the model.
B. Incorrect: This will not validate or set the size requirement.
C. Incorrect: This will make the input field display with a placeholder.
D. Correct: This is the proper way to limit the size of a certain field that is being bound to the
model.

3. You are creating an ASP.NET MVC web application. Within the application, you have
created a partial view for contact email and phone number. Which code segment should
you use to display the partial view on the main page?

 A. <div class="float-right">

<section id="contact">

@Html.ActionLink("ContactPartial")

</section>

</div>

 B. <div class="float-right">

<section id="contact">

@Html.Partial("ContactPartial")

</section>

</div>

 C. <div class="float-right">

<section id="contact">

@RenderPage("ContactPartial")

</section>

</div>

 D. <div class="float-right">

<section id="contact">

@RenderBody("ContactPartial")
</section>

4. You are designing an HTML5 website. You need to design the interface to make the
content of the web page viewable in all types of browsers, including voice recognition
software, screen readers, and reading pens. What should you do? (Each correct answer
presents a complete solution. Choose all that apply.)

 A. Annotate HTML5 content elements with Accessible Rich Internet Application (ARIA)
attributes.
 B. Convert HTML5 forms to XForms.
 C. Ensure that HTML5 content elements have valid and descriptive names.
 D. Use HTML5 semantic markup elements to enhance the pages
 E. Use Resource Description Framework (RDF) to describe content elements throughout the
entire page.

5. You are developing an ASP.NET MVC application and you need to create satellite
assemblies from resource files. What code should you use?

 A. mage.exe /n: /embed:strings.de-DE.resources MyApp.de-DE.resources.dll


 B. WinRes.exe /t: embed:strings.de-DE.resources /culture:de-DE
 C. lc.exe strings.de-DE.resources MyApp.de-DE.resources.dll
 D. al.exe /t:lib /embed:strings.de-DE.resources /culture:de-DE /out:MyApp.de-
DE.resources.dll
 Answer:
 D
 Explanation
 A. Incorrect: Manifest Generation and Editing Tool is for creation and editing of ap-
plication manifests.
B. Incorrect: Windows Form Resource Editor is a visual layout tool for the Windows
Forms user interface.
C. Incorrect: License Compiler reads text license files and compiles them into binary
format.
D. Correct:Assembly Linker generates modules or resource files.
 Razor View Engine VS ASPX View Engine

Razor View Engine ASPX View Engine (Web form view engine)
The namespace used by the Razor The namespace used by the ASPX View Engine is
View Engine is System.Web.Mvc.WebFormViewEngine
System.Web.Razor
The file extensions used by the The file extensions used by the Web Form View Engines
Razor View Engine are different are like ASP.Net web forms. It uses the ASPX extension to
from a web form view engine. It view the aspc extension for partial views or User Controls
uses cshtml with C# and vbhtml
with vb for views, partial view, or templates and master extensions for layout/master
templates and layout pages. pages.
The Razor View Engine is an A web form view engine is the default view engine and
advanced view engine that was available from the beginning of MVC
introduced with MVC 3.0. This is
not a new language but it is
markup.
Razor has a syntax that is very The web form view engine has syntax that is the same as
compact and helps us to reduce an ASP.Net forms application.
typing.
The Razor View Engine uses @ The ASPX/web form view engine uses "<%= %>" or "<%:
to render server-side content. %>" to render server-side content.
By default all text from an @ There is a different syntax ("<%: %>") to make text HTML
expression is HTML encoded. encoded.
Razor does not require the code A web form view engine requires the code block to be
block to be closed, the Razor closed properly otherwise it throws a runtime exception.
View Engine parses itself and it is
able to decide at runtime which is
a content element and which is a
code element.
The Razor View Engine prevents A web form View engine does not prevent Cross Site
Cross Site Scripting (XSS) Scripting (XSS) attack.
attacks by encoding the script or
HTML tags before rendering to
the view.
The Razor Engine supports Test Web Form view engine does not support Test Driven
Driven Development (TDD). Development (TDD) because it depends on the
System.Web.UI.Page class to make the testing complex.
Razor uses "@* … *@" for The ASPX View Engine uses "<!--...-->" for markup and
multiline comments. "/* … */" for C# code.
There is only three transition There are only three transition characters with the Razor
characters with the Razor View View Engine.
Engine.
The Razor View Engine is a bit slower than the ASPX View Engine.

6. If the multiple filters are implemented in mvc in which order the filter execute
Authorization filters
Action filters
Response filters
Exception filters

7. Your application manages the sale of expensive well-drilling equipment. Your IT director
wants you to add functionality that sends an email to a customer’s sales account manager
whenever someone from your client company logs in to the system. What is an
appropriate solution?
 A. Override the AuthorizeAttribute and apply it to the login action. Run the base method
first to handle the authentication and then evaluate the status of the request. If the user is a
customer, send the email.
 B. Create a custom action filter that is globally defined and overrides the
OnActionExecuting method. This action filter evaluates the status of the user and sends the
email if it is a customer.
 C. Override the AuthorizeAttribute that is applied to the login action, check for the user’s
authentication status, and determine whether it is a customer prior to sending it to the base
authentication method.
 D. Create an action filter that overrides the OnActionExecuted method and apply it to the
login action. This action filter evaluates the status of the user and sends the email if it is a
customer.

Hide Answer
Answer:
D
Explanation
A. Incorrect: You should not have an AuthorizeAttribute on your login action, because it ensures
that users have to be authenticated before they log in. Users can never log in to the site.
B. Incorrect: Because this filter is applied globally, it sends the email every time the user takes
an action, rather than just once per visit.
C. Incorrect: You should not have an AuthorizeAttribute on your login action because it ensures
that users have to be authenticated before they log in. Users can never log in to the site.
D. Correct: This is be applied only because the user is leaving the login section of the
application, at which point you also know whether they have been authenticated.

8. what is one support tdd(test driven development)


A. Razor Engine
B. ASPx. View engine
C. both
D none
9. WIF enables you to create a custom token. To be able to use the token, you must create a custom
token handler by overriding which of the following?

 A. SecurityToken
 B. SecurityTokenHandler
 C. SWTToken
 D. Saml2SecurityTokenHandler

Hide Answer

Answer:
B
Explanation
A. Incorrect: SecurityToken is the .NET Framework class that identifies the token.
B. Correct: SecurityTokenHandler is the appropriate class to override for creating a custom token handler.
C. Incorrect: SWTToken is a type of common token.
D. Incorrect: Saml2SecurityTokenHandler is a specific handler for a specific type of token.

10. In your ASP.NET web application you want to display a list of clients on a Web page.
The client list displays 10 clients at a time, and you require the ability to edit the clients.
Which web control is the best choice for this scenario?
Options
- The DetailsView control
- The Table control
- The GridView control
- The FormView control

CORRECT ANSWER : The GridView control


11. How to implement authentication via web.config?
Options
- Include the authentication element.
- Include the authorization element.
- Include the identity element.
- Include the deny element.

CORRECT ANSWER : Include the authentication element.


12. You need to store state data that is accessible to any user who connects to your Web
application. Which object should you use?
Options
- Session
- Application
- Response.Cookies
- Response.ViewState

CORRECT ANSWER : Application


13. Explain the significance of Server .MapPath
Options
- Returns the Virtual Path of the web folder
- Maps the specified virtual path to Physical path
- Returns the physical file path that corresponds to virtual specified path
- All the above

CORRECT ANSWER : Returns the physical file path that corresponds to virtual
specified path
14. ______________ element in the web.config file to run code using the permissions of a
specific user
Options
- < credential> element
- < authentication> element
- < authorization> element
- < identity> element

CORRECT ANSWER : < identity> element


15. An ASP.NET page uses a Datagrid displays employee information. The Web application
supports a large number of concurrent users, who will be saving data from the grid back
to the database. It is important that the Web application doesn't overwhelm the Web
Server.
Options
- Disable View State and don't use session state
- Use View State
- Use URL munging
- Disable ViewState and use Session State

CORRECT ANSWER : Disable View State and don't use session state
16. Which of these data source controls do not implement Caching?
Options
- LinqDataSource
- ObjectDataSource
- SqlDataSource
- XmlDataSource

CORRECT ANSWER : LinqDataSource


17. Which of the following is the default authentication mode for IIS?
Options
- Anonymous
- Windows
- Basic Authentication
- None

CORRECT ANSWER : Anonymous


18. When does Garbage collector run?
Options
- When application is running low of memory
- It runs random
- When application is running for more than 15 minutes
- None of the above

CORRECT ANSWER : When application is running low of memory


19. Which of the following is the way to monitor the web application?
Options
- MMC Event viewers
- Performance logs
- Alerts Snap-ins
- ALL

CORRECT ANSWER : ALL


20. Which of the following languages are used to write server side scripting in ASP.NET?
Options
- C-sharp
- VB
- Both C-sharp and VB
- C++

CORRECT ANSWER : Both C-sharp and VB


21. In which of the following format, output will be rendered to browser when an .aspx page
is requested from the web server?
Options
- JSP
- WML
- XML
- HTML

CORRECT ANSWER : HTML


22. Which of the following is true?
Options
- User controls are displayed correctly in the Visual Studio .NET Designer
- Custom controls are displayed correctly in VS.Net Designer
- User and Custom controls are displayed correctly in the Visual Studio .NET Designer.

CORRECT ANSWER : Custom controls are displayed correctly in VS.Net Designer

23. How ASP.Net different from classic ASP?


Options
- Scripting is separated from the HTML, Code is interpreted seperately
- Code is separated from the HTML and interpreted Code is interpreted separately
- Scripting is separated from the HTML, Code is compiled as a DLL, the DLLs can be
executed on server

CORRECT ANSWER : Scripting is separated from the HTML, Code is compiled as a


DLL, the DLLs can be executed on server
24. Which property of the session object is used to set the local identifier?
Options
- LCID
- SessionId
- Key
- Item

CORRECT ANSWER : LCID


25. Which DLL translate XML to SQL in IIS?
Options
- SQLIIS.dll
- SQLXML.dll
- LISXML.dll
- SQLISAPI.dll

CORRECT ANSWER : SQLISAPI.dll


26. Which of the following does not have any visible interface?
Options
- Datagrid
- Repeater
- DropdownList
- Datalist

CORRECT ANSWER : Repeater


27. _____________ is not a member of ADODBCommand object.
Options
- ExecuteReader
- ExecuteStream
- ExecuteScalar
- CommandText
- Open

CORRECT ANSWER : Open


Questions and solutions

Q:
(1 point) Which of the following is TRUE of shapefiles? Is a very commonly-
used raster data structure . Actually consists of two files-one.shp file and one .mta file Can
only store polygonal data, i.e. "shape files.. Does not store topological information. Is an
essential element for using DEMs in a GIS Question 9 (1 point) In
general, which of the following is almost always TRUE about
vector data vs raster data of exactly the same area Select
A:
8- does not stores topological informations . Spac...
See solution

Q:
Which of the following is not true about Rasters? a. All rasters are images, but not all
images are considered rasters. b. A raster is the data model that describes how an
image is stored. c. All images are rasters, but not all rasters are considered images.
d. Raster and image are two terms that are often interchanged.
A:
Option c) is not true for rasters because all imag...
See solution
Q:
8. Which oster data structure stresser data amatrix and write the cell values into d. All of
the above e. Only (a) and (b) 7. Which of the following objects is not part of the
vector data model in GIS? a point bline ca d volume file by row and column? a cell by cell
b. run length code c. quad tree d. none of the above 9. Which raster data structure stores
the cell values by row and by group? a cell by cell b run length code c. quadtree 10
A:
7 volume Because points, lines, polygons are par...
See solution

Q:
3. Describe the differences between raster and vector based data. Give one example
of data that is typically in raster structure and another example that is typically in
vector structure. Explain why raster format is less accurate and do not reflect either the
nature of geographical features.
A:
See solution

Q:
1. Which data model is used to define the scope of requirements for a database?
Physical Data Model Conceptual Data Model Logical Data Model Enterprise Data Model
2. Which data type specifically supports storing coordinates on a round earth? BLOB
Geometry Raster Geography Which data type specifically supports storing objects such as
points, lines and surfaces? BLOB Geometry Raster Geography 4The body of a Facebook
post is a.Unstructured
A:
Dear Student , As per the requirement submitted ab...
See solution

Q:
Qusetion #1 20% a) Compare between raster and vector data models according
to the following Vector Raster Data Structure Storage requirements Network analysis
Attribute precision Topology b) State five different methods that used for
spatial data capturing.
A:
See solution

Q:
Which of the following is an advantage for raster data compared to vector data in storing
spatial data? a. Vector data must have gaps between features b. Raster cells can capture
variation of spatially continuous phenomena better than vector shapes c. Raster cells are
flexible in shape and size d. Vector shapes require large storage space e. Rasters can map
only one thematic variable
A:
B), Raster cells can capture variation of spatiall...
See solution

Q:
1. Which of the following is a format for storing raster data ? a) Topology b) Spatial
reference c) Geocoding d) Cell encoding 2. By applying the reclassification operator
to a raster layer, a GIS analyst may: a) assigen new values to existing cells b) increase or
decrease the total number of classes c) reduce the total number of raster cells d) all of the
above 3. Which of the following is true for a raster data structure ? a) a 2m grid has
A:
1. d) cell encoding 2.d) all of the above 3. c) Th...
See solution

Workout

1. You are developing an ASP.NET MVC application that takes customer orders.
Orders are restricted to customers with IP addresses based in the United States.
You need to implement a custom route handler. How should you implement the
route handler? (To answer, drag the appropriate line of code to the correct
location or locations. Each line of code may be used once, more than once, or not
at all. You may need to drag the split bar between panes or scroll to view content.)
 IHttpHandler

 IRouteFactory

 IRouteHandler

 IHttpContraint

 RequestContext

 ServerContext

public class USOnlyRouteHandler :

{
public
GetHttpHandler(
requestContext) {
return new USIPHandler(requestContext)
}
Hide Answer
Answer:
 IRouteFactory

 IHttpContraint

 ServerContext

public class USOnlyRouteHandler :


 IRouteHandler
{
public
 IHttpHandler
GetHttpHandler(
 RequestContext
requestContext) {
return new USIPHandler(requestContext)
}
2. given that employee List is type of list<employee>, how can you delete the
employee elements with First Name that are equal to abebe using LINQ?
Solution
[DataObjectMethod(DataObjectMethodType.Delete)]
public void DeleteEmployee(Employee z)
{
using (var ctx = new MyEntity())
{
var x = (from y in ctx.Employees
where y.EmployeeId == z.EmployeeId
select y).FirstOrDefault();
ctx.DeleteObject(x);
ctx.SaveChanges();
}
}

[DataObjectMethod(DataObjectMethodType.Select)]
public List<Employee> GetAllEmployee()
{
using (var ctx = new MyEntity())
{
var x = from y in ctx.Employees
select y;
return x.ToList();
}
}
I can delete a particular record if for example I assign y.EmployeeName == "Harold Javier" to the
Delete method above, but when I assign y.EmployeeId == z.EmployeeId to the above code, the
delete doesn't work. (Note: EmployeeId is the primary key of the Employee table)
public class BaseEmployee
{
public int Id;
public string Name;
}

public class Employee : BaseEmployee


{
public string Address;

public Object Add()


{

Employee employeeDetail = new Employee();


Console.Write("Employee Id:");
employeeDetail.Id = int.Parse(Console.ReadLine());

Console.Write("Employee Name:");
employeeDetail.Name = Console.ReadLine();
Console.Write("Employee Address:");
employeeDetail.Address = Console.ReadLine();
return employeeDetail;

static void Main(string[] args)


{

ArrayList arraylist = new ArrayList();

Employee employeeDetails = new Employee();

bool p = true;

while (p)
{

Console.WriteLine("Employee Record Management System\n");


Console.WriteLine("\n1)Add");
Console.WriteLine("\n2)Edit");
Console.WriteLine("\n3)Delete");
Console.WriteLine("\n4)Dispaly");
Console.WriteLine("\n5)Exit");
Console.Write("\n Select opertaion:");
int Option = int.Parse(Console.ReadLine());

switch (Option)
{
case 1:
arraylist.Add(employeeDetails.Add());
break;

case 4:
foreach (Object obj in arraylist)
{

Employee emp = obj as Employee;


Console.Write("{0}\t\t{1}\t\t{2}", emp.Id, emp.Name, emp.Address);
Console.Write("\n");
//Console.WriteLine(obj);
}

break;
case 3:Console.Write("Enter Employee Id:");
int EId = int.Parse(Console.ReadLine());
foreach(Object obj in arraylist)
{
Employee emp = obj as Employee;
if(EId==emp.Id)
{

arraylist.Remove(emp.Id);
arraylist.Remove(emp.Name);
arraylist.Remove(emp.Address);

}
}

break;

}
}

}
}

3.
How will you maintain the sessions in MVC?
The sessions of an MVC can be maintained by 3 possible ways:
1. ViewBag

The ViewBag is a dynamic type property of ControllerBase class which is the base class
of all the controllers. It’s a dynamic wrapper around ViewData casting is not required
when you use ViewBag. ViewBag only transfers data from controller to view, not visa-
versa. ViewBag values will be null if redirection occurs.

ViewBag support any number of properties or values. if same value found then it will only
consider last value assigned to the property.

Below are various examples of ViewBag.

1. //storing data into viewdata


2. ViewBag.Name = "Kailash";
3. ViewBag.Height = 2.24;
4. //retrieving data from viewdata in controller
5. string ViewBagname = ViewBag.Name;
6. double ViewDataHeight = ViewBag.Height;
7. //retrieving data from viewdata in view using asp.net enging
8. @ViewBag.Name;
9. @ViewBag.Height;
10. @Html.DropDownList("accountid", new SelectList(ViewBag.Accounts, "AccountID", "
AccountName"))
11. @Html.DropDownListFor(x => x.accountId, new SelectList(ViewBag.Accounts, "Accou
ntID",

2. TempData

TempData in ASP.NET MVC is basically a dictionary object derived from


TempDataDictionary.

TempData internally uses session variable and stays for a subsequent HTTP Request. This means
it maintains data when you move one controller to another controller or one action to another
action. As this is a dictionary object null checking and typecasting is required while using it.

Below example shows how to retrieve and put data from or into tempdata both in controller and
view .

1. //storing data into tempdata


2. TempData["Name"] = "Kailash";
3. TempData["height"] = 8.5;
4. //retrieving data from tempdata in controller
5. string name = TempData["Name"].ToString();
6. double height = Convert.ToDouble(TempData["height"]);
7. //retrieving data from tempdata in view using asp.net enging
8. < label > <%TempData["Name"].ToString();%> < /label> < label > <%Convert.ToDoubl
e(TempData["height"]); %> < /label>
9. @if(!TempData["Name "] = null)
10. {
11. @TempData["Name "];
12. }
13. @if(!TempData["height "] = null) {
14. Convert.ToDouble(@TempData["height"]);
15. }

Difference between ViewBag & ViewData:

1. ViewData is a dictionary of objects that is derived from ViewDataDictionary class and is accessible
using strings as keys.
2. ViewBag is a dynamic property that takes advantage of the new dynamic features in C# 4.0.
3. ViewData requires typecasting for complex data type and check for null values to avoid error.
4. ViewBag doesn’t require typecasting for complex data type.

ViewBag & ViewData Example:

C#
Copy Code
public ActionResult Index()
{
ViewBag.Name = "Monjurul Habib";
return View();
}
C#
Copy Code
public ActionResult Index()
{
ViewData["Name"] = "Monjurul Habib";
return View();
}

In View:

C#
Copy Code
@ViewBag.Name
@ViewData["Name"]

TempData:

TempData is also a dictionary derived from TempDataDictionary class and stored in short lives session
and it is a string key and object value. The difference is the life cycle of the object. TempData keeps the
information for the time of an HTTP Request. This mean only from one page to another. This also works with
a 302/303 redirection because it’s in the same HTTP Request. It helps to maintain data when you move from
one controller to other controller or from one action to other action. In other words, when you redirect,
“Tempdata” helps to maintain data between those redirects. It internally uses session variables. Temp data use
during the current and subsequent request only means it is used when you are sure that next request will be
redirecting to next view. It requires typecasting for complex data type and check for null values to avoid error.
It is generally used to store only one time messages like error messages, validation messages.

C#
Copy Code
public ActionResult Index()
{
var model = new Review()
{
Body = "Start",
Rating=5
};
TempData["ModelName"] = model;
return RedirectToAction("About");
}
C#
Copy Code
public ActionResult About()
{
var model= TempData["ModelName"];
return View(model);
}

The last mechanism is the Session which works like the ViewData, like a Dictionary that takes a string for
key and object for value. This one is stored into the client Cookie and can be used for a much more long time.
It also needs more verification to never have any confidential information. Regarding ViewData or ViewBag,
you should use it intelligently for application performance. Because each action goes through the whole life
cycle of regular ASP.NET MVC request. You can use ViewData/ViewBag in your child action, but be
careful that you are not using it to populate the unrelated data which can pollute your controller.

Workout part 2
1. what is bundling and minification in mvc?
Both bundling and minification are the two separate techniques to reduce the load time. The bundling
reduces the number of requests to the Server, while the minification reduces the size of the requested
assets.
Bundling

To improve the performance of the application, ASP.NET MVC provides inbuilt feature to bundle
multiple files into a single, file which in turn improves the page load performance because of
fewer HTTP requests.
Bundling is a simple logical group of files that could be referenced by unique name and loaded
with a single HTTP request.
Minification

Minification is another such performance improvement technique in which it optimizes the


javascript, css code by shortening the variable names, removing unnecessary white spaces, line
breaks, comments, etc. This in turn reduces the file size and helps the application to load faster.
Minification with Visual Studio and Web Essentials Extension
For using this option, you will have to first install the Web Essentials Extension in your Visual
Studio. After that, when you will right-click on any css or javascript file, it will show you the
option to create a minified version of that file.
2. What is web map service(wms)?

Answer

A Web Map Service (WMS) defines an interface that allows a client to get maps of
geospatial data and gain detailed information on specific features shown on the map. A
"map" is defined here as a visual representation of geospatial data, not the geospatial data
itself.

A Web Map Service can:

1. Produce a map – as a picture, as a series of graphical elements, or as a packaged set of


geographic feature data;
2. Answer basic queries about the content of a map; and
3. Tell a client what maps it can produce and which of those can be queried further.

A Web Feature Service (WFS) allows a client to perform data manipulation operations on one or
more geographic features. Data manipulation operations include the ability to Get or Query
features based on spatial and non-spatial constraints, Create a new feature, Modify a feature, or
Delete a feature.

3. Imagine that you want to develop spatially enabled dynamic website using open
software. mention which software you use to manage your spatial data coverage
explain their use?

4. What is Web Workers?


The situation explained above can be handled using Web Workers who will do all the
computationally expensive tasks without interrupting the user interface and typically run on
separate threads.
Web Workers allow for long-running scripts that are not interrupted by scripts that respond to
clicks or other user interactions, and allows long tasks to be executed without yielding to keep
the page responsive.
Web Workers are background scripts and they are relatively heavy-weight, and are not intended
to be used in large numbers.
Web Workers are a simple means for web content to run scripts in background threads. The
worker thread can perform tasks without interfering with the user interface.

5. What is difference between ado.net and entity framework?


Entity framework is an Object/Relational Mapping (O/RM) framework. It is an enhancement to
ADO.NET that gives developers an automated mechanism for accessing & storing the data in the
database.
Both ADO.Net & Entity Frameowrks are features of .NET Framework.
ADO.Net : Active X Data Object is used to connect to the databse and fetch the requested results
by the general command frames that what we give in Database side.
Entity Framework : Unlike to the ADO.Net, entity frameowrk also fetches the data by using the
Language Integrated Queries(LINQ).
Note: ADO.Net is faster way for accessing when comparing to Entity framework.
Entity framework is an Object Relational Mapping (ORM) framework that offers an automated
mechanism to developers for storing and accessing the data in the database. This tutorial covers
the features of Entity Framework using Code First approach. It also explains the new features
introduced in Entity Framework 6.

An SQL injection attack can be done with the following intentions −


 To dump the whole database of a system,
 To modify the content of the databases, or
 To perform different queries that are not allowed by the application.

Prevent SQL injection attacks.

Applications frequently take external input (from a user or another external agent) and
perform actions based on that input. Any input that is directly or indirectly derived from
the user or an external agent might have content that uses the syntax of the target
language in order to perform unauthorized actions. When the target language is a
Structured Query Language (SQL), such as Transact-SQL, this manipulation is known as a
SQL injection attack. A malicious user can inject commands directly into the query and
drop a database table, cause a denial of service, or otherwise change the nature of the
operation being performed.

 Entity SQL injection attacks:

SQL injection attacks can be performed in Entity SQL by supplying malicious input
to values that are used in a query predicate and in parameter names. To avoid the
risk of SQL injection, you should never combine user input with Entity SQL
command text.

Entity SQL queries accept parameters everywhere that literals are accepted. You
should use parameterized queries instead of injecting literals from an external
agent directly into the query. You should also consider using query builder
methods to safely construct Entity SQL.

 LINQ to Entities injection attacks:

Although query composition is possible in LINQ to Entities, it is performed through


the object model API. Unlike Entity SQL queries, LINQ to Entities queries are not
composed by using string manipulation or concatenation, and they are not
susceptible to traditional SQL injection attacks.

You might also like