Server.MapPath error

T

tshad

I am using VS2002, at home and can't seem to get Server.MapPath to work. I
get the error:

The type or namespace name 'Server' could not be found (are you missing a
using directive or an assembly reference?)

My code page is essentially:

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;

....

public virtual void save()
{
FileStream s = new

// Change the file path below to the appropriate dir:
FileStream(Server.MapPath("profile.bin"),
FileMode.Create, FileAccess.Write);

BinaryFormatter b = new BinaryFormatter();
b.Serialize(s, this);
s.Close();
}


What am I missing from here that would cause the Server object not to be
recognized. I don't have this much trouble with the VS2003 that I have at
work.

Is there something different that would make it work in 2003 and not in
2002?

Thanks,

Tom
 
H

hashimisayed

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top