0
votes

I want to use Server.MapPath in my Web Form (Windows Form App) But it is not taking error :

LinkedResource resource = new LinkedResource((Microsoft.SqlServer.Server.MapPath("Images\007jvr.gif")));

Error 1 The type or namespace name 'MapPath' does not exist in the namespace 'Microsoft.SqlServer.Server' (are you missing an assembly reference?)

What I need to do?

1
are you getting file from SQL? you can use HttpContext.Current.Server.MapPath("Images\007jvr.gif");Ashfaq Shaikh
I assume you do mean Web Form - cos thats not the same as a Windows Form. Are you using it in a aspx page or a code file or ...?Dale K

1 Answers

3
votes

use this syntax to get file from Folder.

    LinkedResource resource = new 
LinkedResource(HttpContext.Current.Server.MapPath("Images\007jvr.gif"));