Create a new class called clsbusiness layer

Assignment Help DOT NET Programming
Reference no: EM13765044

Step- Create a new class called clsBusiness Layer.

Add the following code in the clsBusinessLayer class:

// **** Add the following at the top of the class file,

// Add your comments here

using System.Net.Mail;

//**** Add the following code inside the body of public class clsBusinessLayer ****

public static bool SendEmail(string Sender, string Recipient, string bcc, string cc, string Subject, string Body)

{

try {

// Add your comments here

MailMessage MyMailMessage = new MailMessage();

// Add your comments here

MyMailMessage.From = new MailAddress(Sender);

// Add your comments here

MyMailMessage.To.Add(new MailAddress(Recipient));

// Add your comments here

if (bcc != null && bcc != string.Empty) {

// Add your comments here

MyMailMessage.Bcc.Add(new MailAddress(bcc));

}

// Add your comments here

if (cc != null && cc != string.Empty) {

// Add your comments here

MyMailMessage.CC.Add(new MailAddress(cc));

}

// Add your comments here

MyMailMessage.Subject = Subject;

// Add your comments here

MyMailMessage.Body = Body;

// Add your comments here

MyMailMessage.IsBodyHtml = true;

// Add your comments here

MyMailMessage.Priority = MailPriority.Normal;

// Add your comments here

SmtpClient MySmtpClient = new SmtpClient();

// Add your comments here

MySmtpClient.Port = 25;

MySmtpClient.Host = "127.0.0.1";

// Add your comments here

MySmtpClient.Send(MyMailMessage);

// Add your comments here

return true;

} catch (Exception ex) {

// Add your comments here

return false;

}

}

STEP 2: Integration

Open the frmLogin web form code behind file and add the following code to the body of the if (dsUserLogin.tblUserLogin.Count < 1) statement, just above the return statement:

// Add your comments here

// Add your comments here

if (clsBusinessLayer.SendEmail("[email protected]", "[email protected]", "", "", "Login Incorrect", "The login failed for UserName: " + Login1.UserName + " Password: " + Login1.Password))

{

Login1.FailureText = Login1.FailureText + " Your incorrect login information was sent to [email protected]";

}

NOTE: Change the [email protected] and [email protected] to your e-mail and someone else's e-mail for testing.
Optional: Perform this step only if you are doing this lab using Visual Studio 2008 installed on your own computer, your computer has Internet Information Services (IIS) installed, and you have administrative rights to IIS. If you are doing this lab using the iLab (Citrix) server, or if you do not have access to IIS, skip to step 8.

Open IIS (Start > Control Panel > Administrative Tools > Internet Information Services), navigate to the Default SMTP Virtual Server, right-click on it, and left-click on Properties.

Click the Access tab, then the Relay button, then Add, and add the IP 127.0.0.1. Click OK, OK, and APPLY when finished.
We have a security hole in our web application. If you start the web application by going to the login page, you can bypass the login page by simply typing the name of a form in the URL (try it). There is some limited protection because of the check we are doing for user role, but it still allows a user to get to pages we don't want them to get to unless the role is set properly. Add a security check in the Page_Load of each sensitive page (Manage Users, Add New Employee, View User Activity, Edit Employees), check for the Session role item with a value of "A," and, if the user is accessing these pages without the proper permissions, redirect back to the frmLogin.aspx page.

This still leaves the possibility of a person bypassing the login page. We will fix that by using forms authentication. Add the following to the web.config file. (There should already be an authentication section - replace it with this.)

<authentication mode="Forms">

<forms loginUrl="frmLogin.aspx" />

</authentication>

<authorization >

<deny users="?" />

</authorization>

This will redirect users to the login page if they have not yet gone through it for login. This process will use a cookie - when the user successfully logs in in a cookie is set that allows the user to go to other pages. If that cookie is not set then the user is redirected to the login page if they try to go to any other page. Add the cookie code by adding this code in the frmLogin.aspx C# code after each place that you have e.Authenticated = true:

FormsAuthentication.RedirectFromLoginPage(Login1.UserName, false);

Hints:

Make sure you reestablish your database connection if you copied the files from a previous lab. Also, make sure to update the web.config file with the database connection string.

Update any DataSource controls you added with the new payroll database location.

When you manually try to go to a second page by skipping the login page, a cookie is set specifying the name of the page you were attempting to go to. Once you login successfully, ASP.Net will automatically attempt to navigate back to that page. You can reset the cookie so that the next page is frmMain, as expected, by typing that page in the URL for the browser before logging in.

Reference no: EM13765044

Questions Cloud

Compute the macaulay duration : Compute the Macaulay duration of a ten-year 6% $1,000 bond having annual coupons and a redemption of $1,200 if the yield to maturity is 8%.
How the legal concepts in the selected case can be applied : Write an explanation of no more than 700 words about how the legal concepts in the selected case can be applied within a business managerial setting
What is the break-even exchange rate : Suppose your company imports computer motherboards from Singapore. The exchange rate is currently 1.2943 S$/US$. You have just placed an order for 24,000 motherboards at a cost to you of 239.00 Singapore dollars each. What is the break-even exchange ..
The importance of reports : Explain in your own words the importance of report writing and why you believe it is critical to the system forensics industry. Discuss the need for forensic reports when testifying as an expert witness.
Create a new class called clsbusiness layer : Create a new class called clsBusiness Layer. public static bool SendEmail string Sender, string Recipient, string bcc, string cc, string Subject, string Body
Comma between the account title : You are to prepare the missing adjusting entry. Please indicate DR (debit) or CR (credit) to the left of the account title, and place a comma between the account title and the amount of the adjustment.
Suppose the current exchange rate : Suppose the current exchange rate for the Polish zloty is Z 2.76. The expected exchange rate in three years is Z 2.82. What is the difference in the annual inflation rates for the United States and Poland over this period? (Do not round intermediate ..
Advantages and disadvantages for each business form : There are seven forms of business: sole proprietorship, partnership, limited liability partnership, limited liability company (including the single member LLC), S Corporation, Franchise, and Corporation
What is the accounting and financial break-even quantity : A project has the following estimated data: price = $66 per unit; variable costs = $43 per unit; fixed costs = $16,500; required return = 8 percent; initial investment = $25,000; life = five years. What is the accounting break-even quantity? What is ..

Reviews

Write a Review

DOT NET Programming Questions & Answers

  Create an asp.net web application

Create an ASP.NET web application main form containing a list of hyperlinks and images. You will also add a form with five text boxes and a Submit button.

  Prepare a marymount faculty site

Prepare a Marymount faculty site

  Create a console-based application named multiplication

a. Create a console-based application named Multiplication whose main() method asks the user to input and then calls a method named MultiplicationTable(), which displays the results of multiplying the integers by each of the number 2 through 10

  Create a class called invoice that hardware store might use

Provide a method named GetInvoiceAmount that calculates an invoice amount and returns the answer as a decimal value. Write a console based test app names InvoiceTest that demonstrates class Invoice's capabilities.

  How linear structures-particularly arrays-are implemented

Project at work calls for storage of computer maintenance schedule information. Using C# as source language, investigate how linear structures-particularly arrays-are implemented.

  Prepare a web application

Prepare a web application that will be used to keep track of patients registering in a hospital.

  Create a home page with navigation bar

Create a home page with navigation bar to the three (3) pages with images listed below and a Cascading Style Sheet (.css) for bisque color and Arial text.

  Question 1a using the help of a diagram describe the layer

question 1a using the help of a diagram describe the layer of the .net framework that sits between visual basic.net

  Prepare a marymount faculty site and you have each been

prepare a marymount faculty site and you have each been provided a professor to profile.nbsp you have to use html5 and

  The data for 10 professional baseball teams for the year

the data for 10 professional baseball teams for the year 2001 is given below. write a c console application that does

  Write a program that can be used to determine the tip amount

Write a program that can be used to determine the tip amount that should be added to a restaurant charge. Allow the user to input the total, before taxes and the tip percentage (15% or 20%). Produce output showing the calculated values including the ..

  Write a program that computes the amount of money

Write a program that computes the amount of money the computer club will receive from proceeds of their granola bar sales project. Allow the user to enter the number of cases sold and the sale price per bar. Each case contains 12 bars; each case is p..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd