Truemag

  • Categories
    • Tips And Tricks
    • Internet
    • PHP
    • Javascript
    • CSharp
    • SQL Server
    • Linux
  • Lastest Videos
  • Our Demos
  • About
  • Contact
  • Home
  • Write With Us
  • Job Request
Home CSharp Calling Server.MapPath In C# Class

Calling Server.MapPath In C# Class

In ASPX code behind, we can use Server.MapPath to get the absolute path but in C# class of an web application we need to use HttpContext.Current.Server.MapPath instead.

For example:

string FilePath = Path.Combine(HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["PDFs"].ToString()), "Jobs.pdf");

string FilePath = Path.Combine(HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["PDFs"].ToString()), "Jobs.pdf");

Dec 17, 2014Hoan Huynh
How to amplify low signals with a cell phone signal boosterHow to create new custom menu item in your wordpress back end?
You Might Also Like:
  • C# Get File Extension Without Sub String Or Split Function
  • C# Read File Content
  • Collabtive: Class DateTimeZone could not be located
  • SQL SERVER How to import Text/CSV file into table
  • ASP.NET C# Export Data To CSV And Prompt Download
  • Get or Find Facebook Profile Id Number
  • PHP Connect To MS SQL Server
  • Error: ‘ping’ is not recognized as an internal or external command, operable program or batch file.
  • IE Enable/Disable Proxy Server by using script file
  • JQuery Read Rows And Columns Of HTML Table
Hoan Huynh

Hoan Huynh is the founder and head of 4rapiddev.com. Reach him at [email protected]

7 years ago CSharpHttpContext, MapPath, Server.MapPath316
0
GooglePlus
0
Facebook
0
Twitter
0
Digg
0
Delicious
0
Stumbleupon
0
Linkedin
0
Pinterest
Most Viewed
PHP Download Image Or File From URL
24,451 views
Notepad Plus Plus Compare Plugin
How To Install Compare Text Plugin In Notepad Plus Plus
21,832 views
Microsoft SQL Server 2008 Attach Remove Log
Delete, Shrink, Eliminate Transaction Log .LDF File
17,650 views
JQuery Allow only numeric characters or only alphabet characters in textbox
14,985 views
C# Read Json From URL And Parse/Deserialize Json
11,712 views
4 Rapid Development is a central page that is targeted at newbie and professional programmers, database administrators, system admin, web masters and bloggers.
Recent Posts
  • Things to Learn about Installingderm Loan Type S
  • Online Photo Editor – Free Photoediting Software
  • A Guide to Finding the Best Paper Sellers
  • Photoediting in Home Isn’t Hard to Do!

  • Free Photo Editor Online
Categories
  • CSharp (45)
  • Facebook Graph API (19)
  • Google API (7)
  • Internet (87)
  • iPhone XCode (8)
  • Javascript (35)
  • Linux (27)
  • MySQL (16)
  • PHP (84)
  • Problem Issue Error (29)
  • Resources (32)
  • SQL Server (25)
  • Timeline (5)
  • Tips And Tricks (141)
  • Uncategorized (647)
Recommended
  • Custom Software Development Company
  • Online Useful Tools
  • Premium Themes
  • VPS
2014 © 4 Rapid Development