---
title: "Server.MapPath does not exist in currect context"  
description: "Server.MapPath does not exist in currect context"  
author: "Samuel Fernandes"  
published: 2013-10-05  
updated: 2013-10-05  
canonical: https://www.mindstick.com/forum/1589/server-mappath-does-not-exist-in-currect-context  
category: "asp.net mvc"  
tags: ["asp.net mvc"]  
reading_time: 1 minute  

---

# Server.MapPath does not exist in currect context

here's one stupid :)

Inside my [project](https://www.mindstick.com/articles/105927/how-to-excel-at-managing-multiple-projects) mvc4 I have [namespace](https://www.mindstick.com/articles/12552/namespace)

```
prj.MVC4.Controllers
```

where I'm using [Server.MapPath](https://www.mindstick.com/forum/2132/server-mappath-in-asp-dot-net)(..) without [problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic)

and on prj.MVC4.Models Server.MapPath(...) does not exist on current context.

I'm aware that Server.MapPath resides in System.Web and both namespace and [assembly](https://www.mindstick.com/articles/25/global-assembly-cache) are added into [class](https://www.mindstick.com/blog/165/generic-class-in-c-sharp) with using System.Web and System.Web.dll is added to the prj.

on ctrl + . I'm getting Microsoft.SqlServer as suggested namespace to add.

How to [fix](https://yourviews.mindstick.com/view/80763/donald-trump-ki-jeet-fix-hai) this?

## Replies

### Reply by E E Cummings

The server is a property of the controller, to access it elsewhere while running a web application you can use

```
System.Web.HttpContext.Current.Server
```


---

Original Source: https://www.mindstick.com/forum/1589/server-mappath-does-not-exist-in-currect-context

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
