Path

  • Thread starter Thread starter shapper
  • Start date Start date
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
 
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
 
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


Back
Top