David
David

Reputation: 181

Could not find a part of the path (asp.net)

Hi I keep getting this error:

Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path 'D:\Websites\site_sitecore\Website\Template\claim.htm'.

The code I'm using is:

message.BodyFileName = "/Template/claim.htm";

Basically trying to send an email template via email but I can't get it to find the path. If I use a external link with that file it denies access to it but can't work out how to get the correct path to work internally, any ideas?

Upvotes: 0

Views: 1932

Answers (2)

Francis Gilbert
Francis Gilbert

Reputation: 3442

Use Server.MapPath('~/Template/claim.htm'). Does that work?

Upvotes: 1

Samir Adel
Samir Adel

Reputation: 2499

try message.BodyFileName = "Template/claim.htm";

Upvotes: 0

Related Questions