Path

S

shapper

Hello,

I am using Server.MapPath("~/App_Data/") to get the absolute path.

I need to create the full path of a file. So I can use:

String.Concat(Server.MapPath("~/App_Data/"), filename);

But I get an error if I pass just "~/App_Data" ... Ok I can solve that
easy.

But I think there is a .NET method for this ... I have that idea but I
can't find it.

Do you know which one it is?

Thanks,
Miguel
 
S

shapper

Hello,

I am using Server.MapPath("~/App_Data/") to get the absolute path.

I need to create the full path of a file. So I can use:

String.Concat(Server.MapPath("~/App_Data/"), filename);

But I get an error if I pass just "~/App_Data" ... Ok I can solve that
easy.

But I think there is a .NET method for this ... I have that idea but I
can't find it.

Do you know which one it is?

Thanks,
Miguel

Sorry, I finally found it. Is System.IO.Path.Combine.

Thanks,
Miguel
 
P

Peter Duniho

shapper said:
Hello,

I am using Server.MapPath("~/App_Data/") to get the absolute path.

I need to create the full path of a file. So I can use:

String.Concat(Server.MapPath("~/App_Data/"), filename);

But I get an error if I pass just "~/App_Data" ... Ok I can solve that
easy.

But I think there is a .NET method for this ... I have that idea but I
can't find it.

Do you know which one it is?

If you use the System.IO.Path class, you can combine paths without as
much fiddling in your own code. It will insert directory separator
characters as necessary.

Pete
 

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

Similar Threads

Relative Path 3
export to PDF problem 2
App_Data files 1
Load XML file 3
Can't find my images folder - why? 7
XML, LINQ and Server.MathPath 4
newbie: /app_data 1
Resize image in asp.net 2

Top