Server.MapPath in C# class

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

I’m getting this error, for obvious reasons. But I don’t know how to correct it.
when I exclude the mappath, then the file isn’t found as it’s searching a folder on my pc. please help.

[size=2][size=2][color=#0000ff]using[/color][/size][size=2] System.Configuration;[/size]
[size=2][color=#0000ff]using[/color][/size][size=2] System;[/size]
[size=2][color=#0000ff]using[/color][/size][size=2] System.Web.Mail;[/size]
[size=2][color=#0000ff]using[/color][/size][size=2] System.Xml;[/size]
[size=2][color=#0000ff]using[/color][/size][size=2] System.IO;[/size]
[size=2][color=#0000ff]using[/color][/size][size=2] System.Data.SqlClient;
BuildEmail em = [/size][size=2][color=#0000ff]new[/color][/size][size=2] BuildEmail(acct_id);[/size]
[size=2]GetEmailAddresses gea = [/size][size=2][color=#0000ff]new[/color][/size][size=2] GetEmailAddresses();[/size]


Server is a propery of the Page class. if your code is not inheriting from this, you would need to call [size=1]



thanks, but I’m still getting an error:

[size=2][color=#0000ff]public[/color][/size][size=2] GetEmailAddresses(){

GetEmailAddresses gea = [/size][size=2][color=#0000ff]new[/color][/size][size=2] GetEmailAddresses();







Exception of type System.StackOverflowException was thrown.

ah. i think i see why. you have an infinite recursion in your constructor there…

inside the constructor GetEmailAddresses() you are creating a new instance of GetEmailAddresses which in turn calls the constructor which creates a new GetEmailAddresses which calls the constructor which creates a new GetEmailAddresses…