getting path

Discussion in 'General troubleshooting' started by roggss, Mar 17, 2012.

  1. Hi,

    I had been told here that I will use

    var path = Server.MapPath("~/resume");

    to get the resume folder under may application 1 (named client), which resides in root/client folder...

    now i made a second application (named admin), which resides in root/admin folder..

    so basically i had two folders coming from root....now what i need to do is to get the folder of resume (which is root/client/resume) from my second application (root/admin/)..

    I tried var path = Server.MapPath("../../Client/resume"); but no avail.

    Any help pls?

    roggss
     
  2. heres what I got so far.. which works on my localhost and not on Winhost

    var path = Server.MapPath("~");

    var fullPath = Path.GetFullPath(path);

    var file = Path.Combine(fullPath, "../Client/resume/" + member.Resume);

    return File(new FileStream(file, FileMode.Open), "text/plain", member.Resume);


    Note: my application run under

    root/Admin/

    and I'm trying to get the file from

    root/Client/Resume

    Please help..

    thanks
     
    Last edited by a moderator: Oct 14, 2015
  3. var path = Server.MapPath("/");

    var fullPath = Path.GetFullPath(path);

    var file = Path.Combine(fullPath, "/Client/resume/" + member.Resume);

    return File(new FileStream(file, FileMode.Open), "text/plain", member.Resume);
     
  4. Hi,

    I got this exception..


    Security Exception

    Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

    Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.


    any idea?
     
  5. thank you so much..
     

Share This Page