Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Embed Docsie Documentation in ASP.NET Core Razor Pages

Simple example showing how to integrate Docsie documentation into ASP.NET Core Razor Pages applications. Works on Windows, macOS, and Linux with .NET 9.0+.

.NET License

Quick Start

Clone and run:

git clone https://github.com/PhilippeTrounev/razor-pages-docsie-sample.git
cd razor-pages-docsie-sample/DocsieBlazorSample
dotnet run

Open https://localhost:5001/docs

Basic Integration (3 lines)

Pages/Docs.cshtml:

@page
<link href="https://lib.docsie.io/current/styles/docsie.css" rel="stylesheet" />
<div data-ddsroot></div>
<script async src="https://lib.docsie.io/current/service.js"
        data-docsie='docsie_pk_key:deployment_YOUR_ID'>
</script>

Features

  • Server-side rendering with Razor Pages
  • JWT authentication support
  • Multi-language documentation
  • Version control
  • Full-text search
  • Analytics tracking

JWT Authentication

For secured documentation, generate JWT tokens server-side:

Pages/Docs.cshtml.cs:

using System.IdentityModel.Tokens.Jwt;
using Microsoft.IdentityModel.Tokens;

public class DocsModel : PageModel
{
    public string JwtToken { get; private set; }

    public void OnGet()
    {
        JwtToken = GenerateJwtToken();
    }

    private string GenerateJwtToken()
    {
        var masterKey = Configuration["Docsie:MasterKey"];
        var key = new SymmetricSecurityKey(
            System.Text.Encoding.UTF8.GetBytes(masterKey));
        var credentials = new SigningCredentials(
            key, SecurityAlgorithms.HmacSha256);

        var token = new JwtSecurityToken(
            expires: DateTime.UtcNow.AddHours(1),
            signingCredentials: credentials
        );

        return new JwtSecurityTokenHandler().WriteToken(token);
    }
}

Pages/Docs.cshtml:

<script async src="https://lib.docsie.io/current/service.js"
        data-docsie='docsie_pk_key:@Model.DeploymentId,authorizationToken:@Model.JwtToken'>
</script>

Configuration

appsettings.json:

{
  "Docsie": {
    "DeploymentId": "deployment_YOUR_ID",
    "MasterKey": "your_master_key_here"
  }
}

Use environment variables in production:

Docsie__DeploymentId=deployment_YOUR_ID
Docsie__MasterKey=your_master_key_here

Project Structure

DocsieBlazorSample/
├── Pages/
│   ├── Docs.cshtml           # Documentation page
│   ├── Docs.cshtml.cs        # Code-behind
│   └── Shared/
│       └── _Layout.cshtml    # Layout
├── Program.cs
└── appsettings.json

Troubleshooting

Blank page?

  • Check browser console for errors
  • Verify deployment ID is correct
  • Ensure service.js (not styles.js) is loaded

Authentication failing?

  • Verify master key matches your deployment
  • Check token hasn't expired
  • Validate token at jwt.io

Port conflict?

  • Change port in Properties/launchSettings.json
  • Kill existing process: lsof -ti:5000 | xargs kill -9

Related Examples

  • Blazor WebAssembly - Client-side Blazor integration
  • React integration (coming soon)
  • Vue.js integration (coming soon)
  • Next.js integration (coming soon)

Requirements

  • .NET SDK 9.0+ (compatible with .NET 6.0+)
  • Modern web browser
  • Docsie account

Use Cases

Product Documentation

Embed product documentation directly in your ASP.NET application. Users get contextual help without leaving your app. Supports versioning to match your software releases.

API Documentation

Create interactive API documentation portals. Include code examples, request/response samples, and authentication guides. Version your API docs alongside your API releases.

Knowledge Base

Build self-service knowledge bases for customer support. Reduce support tickets by providing searchable documentation. Track which articles users read most.

In-App Help System

Add contextual help tooltips and guides within your application. Improve user onboarding and feature discovery. Update help content without redeploying your app.

Technical Documentation

Host developer documentation, architecture guides, and internal wikis. Keep technical docs version-controlled and synced with your codebase.

Training Materials

Create employee onboarding documentation and training courses. Track completion and engagement through analytics. Support multiple languages for global teams.

Compliance Documentation

Maintain policy documents, compliance guides, and regulatory documentation. Control access with JWT authentication. Audit who reads critical documents.

Customer Portal Documentation

Build customer-facing help centers within your SaaS application. Secure documentation per customer using multi-tenant authentication. Brand documentation to match your company style.

Support

License

MIT

About

ASP.NET Core Razor Pages example showing how to embed Docsie documentation

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages