3 Replies - 867 Views - Last Post: 21 February 2019 - 09:57 AM Rate Topic: -----

#1 Skydiver   User is online

  • Code herder
  • member icon

Reputation: 7027
  • View blog
  • Posts: 23,867
  • Joined: 05-May 12

Do as I say, not as I do...

Posted 13 November 2018 - 09:36 AM

I was reviewing somebody else's code trying to figure out why their files are not appearing where they are expecting. I stumbled across this:
string AppData = HttpContext.Current.Server.MapPath("~/App_Data");
string path = AppData + "\\" + sFName;
string text2write = sDoc;

//Do not create file on Server
System.IO.StreamWriter writer = new System.IO.StreamWriter(path);
writer.Write(text2write);
writer.Close();



Yeah, right... "Do not create the file on the Server", but what were they expecting MapPath() to do?

Is This A Good Question/Topic? 0
  • +

Replies To: Do as I say, not as I do...

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15226
  • View blog
  • Posts: 60,964
  • Joined: 12-June 08

Re: Do as I say, not as I do...

Posted 13 November 2018 - 09:58 AM

Haha.. This is not the file you are looking for.
Was This Post Helpful? 0
  • +
  • -

#3 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6820
  • View blog
  • Posts: 31,419
  • Joined: 10-May 07

Re: Do as I say, not as I do...

Posted 13 November 2018 - 01:05 PM

Don't you put that file on my server Ricky Bobby!
Was This Post Helpful? 0
  • +
  • -

#4 hexagod   User is offline

  • 😂😂😂
  • member icon

Reputation: 31
  • View blog
  • Posts: 577
  • Joined: 29-October 16

Re: Do as I say, not as I do...

Posted 21 February 2019 - 09:57 AM

no2pencil
😂😂😂
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1