I have an image stored on the server at:
C:\inetpub\wwwroot\imageupload\images
in my code I want to use an image from folder images, so I'm trying to do the following:
Server.MapPath("/images/sample1.jpg")
But I get an error like:

Please help me resolve this error.
As with multiple code submission responses, it looks like this
.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<%@ Register Assembly="CS.Web.UI.CropImage" Namespace="CS.Web.UI" TagPrefix="cs" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<cs:CropImage ID="wci1" runat="server" />
</body>
</html>
.aspx.cs
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
wci1.Crop(Server.MapPath("/imageupload/images/sample1.jpg"));
Image img = new Image();
img.ImageUrl = "images/sample1.jpg?rnd=" + (new Random()).Next();
this.Controls.Add(img);
}
}
The cropping method from the .dll file that I used from http://imagecropping.codeplex.com/
Ishan source
share