forked from rapPayne/WebGoat.Net
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Default.aspx.cs
32 lines (30 loc) · 1.04 KB
/
Default.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System;
using System.IO;
using System.Web;
using Infrastructure;
namespace WebSite
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
var sessionCookie = new HttpCookie("SessionId", Session.SessionID);
Response.Cookies.Add(sessionCookie);
string output = string.Empty;
using (var productRepository = new ProductRepository())
{
var top4Products = productRepository.GetTopProducts(4);
foreach (var product in top4Products)
{
var imageUrl = "images/productImages/" + product.ProductId.ToString() + ".jpg";
if (!File.Exists(Server.MapPath(imageUrl)))
{
imageUrl = "images/productImages/NoImage.jpg";
}
output += product.ToSummaryHtml(imageUrl);
}
lblProductList.Text = output;
}
}
}
}