# DocumentViewer.DocumentPath Property

> Gets or sets the path to the document, which will be displayed in the DocumentServer.Web.DocumentViewer. The document will be processed and displayed the next time the DocumentServer.Web.DocumentViewer is initialized. Please note that the extension of the specified filename must match the file's type, since the viewer determines the file type based on its extension and passes this information on to the DocumentServer.DocumentController which then in turn will try to load the document. Obviously, this process will fail, if the file extension suggests the wrong file type.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Property
- **Introduced:** 15.0
- **Not found:** no package of this release declares this member on this type or on a class it derives from
- **Namespace:** `TXTextControl.DocumentServer.Web`
- **Package:** `TXTextControl.TextControl.ASP.SDK` (assembly `TXDocumentServer.Web.DocumentViewer.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXDocumentServer.Web.DocumentViewer.dll` from the setup
- **Path:** TX Text Control .NET Server > Reference > TXTextControl.DocumentServer.Web > DocumentViewer.DocumentPath Property
- **621 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-documentserver-web/documentviewer/documentpath-property/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-documentserver-web/documentviewer/documentpath-property/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-documentserver-web/documentviewer/documentpath-property/llms-full.txt

---

### Description

Gets or sets the path to the document, which will be displayed in the [DocumentServer.Web.DocumentViewer](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-documentserver-web/documentviewer/llms-full.txt). The document will be processed and displayed the next time the [DocumentServer.Web.DocumentViewer](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-documentserver-web/documentviewer/llms-full.txt) is initialized. Please note that the extension of the specified filename must match the file's type, since the viewer determines the file type based on its extension and passes this information on to the [DocumentServer.DocumentController](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-documentserver/documentcontroller/llms-full.txt) which then in turn will try to load the document. Obviously, this process will fail, if the file extension suggests the wrong file type.

### Syntax

No package of this release declares this member. The declaration below is the reference's, and code that uses it does not compile.

```csharp
public string DocumentPath { get; set; }
```

```vbnet
Public Property DocumentPath() As String
```

### Examples

`DocumentServer.Web.DocumentViewer.DocumentPath` belongs to the legacy Web Forms viewer. In the current ASP.NET Core viewer, configure the server-rendered component through `DocumentViewerSettings.DocumentPath`; interactive page state and styling are handled by the viewer client.

```csharp
documentViewerSettings.DocumentPath = @"App_Data\document.docx";
if (!string.IsNullOrWhiteSpace(documentViewerSettings.DocumentPath))
{
    Console.WriteLine($"Document Path: {documentViewerSettings.DocumentPath}");
}
```

```vbnet
documentViewerSettings.DocumentPath = "App_Data\document.docx"
If Not String.IsNullOrWhiteSpace(documentViewerSettings.DocumentPath) Then
    Console.WriteLine($"Document Path: {documentViewerSettings.DocumentPath}")
End If
```

---

## Nearby

- **Previous:** [DocumentViewer.DocumentController Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-documentserver-web/documentviewer/documentcontroller-property/llms-full.txt)
- **Next:** [DocumentViewer.EditMode Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-documentserver-web/documentviewer/editmode-property/llms-full.txt)
