Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
Calling a screenshot API from ASP.NET Core is an ordinary outbound HTTP request: send the target URL and rendering options with the provider’s required credentials, then return the image bytes—or handle the JSON or URL response the provider documents. You do not need a .NET SDK to make the request. This guide shows a Minimal API, an MVC controller, and a typed HttpClient setup, with explicit places to adapt for your chosen provider.
How the ASP.NET Core integration works
Your ASP.NET Core application does not need to run a browser. It sends an HTTP request to a hosted screenshot service; that service loads the page and returns the capture in the response format it supports. The basic flow is:
- Accept or determine a target URL on your server.
- Send a request to the provider endpoint with authentication and capture parameters.
- Check the provider’s status and response format.
- Return the image, PDF, or other result from your own endpoint—or store it and return a reference.
The exact endpoint, HTTP method, credential location, query parameter names, supported formats, and error behavior are provider-specific. The generic examples below are patterns, not tested integrations with a particular vendor. Replace the endpoint and request details with those in the selected provider’s documentation.
Build a Minimal API screenshot route
For a quick local project, create an ASP.NET Core web application with dotnet new web. The Microsoft Minimal API tutorial uses a Program.cs file and mapped routes; the development server lets you exercise the route in a browser or Swagger setup. See Microsoft’s Minimal API tutorial.
#1 Best Overall
- CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
- WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
- A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents
Register IHttpClientFactory and bind the key from configuration. The code below assumes a provider whose documented endpoint accepts a GET request, a bearer token, and a URL query parameter; those details are illustrative and must be adapted.
using System.Net.Http.Headers;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddHttpClient();
var app = builder.Build();
app.MapGet("/screenshot", async (
string url,
IHttpClientFactory factory,
IConfiguration config,
CancellationToken cancellationToken) =>
{
if (!Uri.TryCreate(url, UriKind.Absolute, out var target) ||
(target.Scheme != Uri.UriSchemeHttp && target.Scheme != Uri.UriSchemeHttps))
{
return Results.BadRequest("url must be an absolute HTTP or HTTPS URL");
}
var apiKey = config["ScreenshotApi:ApiKey"];
if (string.IsNullOrWhiteSpace(apiKey))
{
return Results.Problem("Screenshot API key is not configured", statusCode: 500);
}
var endpoint = "https://provider.example/v1/screenshot?url=" +
Uri.EscapeDataString(target.ToString());
using var request = new HttpRequestMessage(HttpMethod.Get, endpoint);
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", apiKey);
var client = factory.CreateClient();
using var response = await client.SendAsync(
request, HttpCompletionOption.ResponseHeadersRead, cancellationToken);
if (!response.IsSuccessStatusCode)
{
return Results.Problem(
$"Screenshot provider returned {(int)response.StatusCode}",
statusCode: StatusCodes.Status502BadGateway);
}
var contentType = response.Content.Headers.ContentType?.MediaType;
if (contentType is null ||
!(contentType.StartsWith("image/", StringComparison.OrdinalIgnoreCase) ||
contentType.Equals("application/pdf", StringComparison.OrdinalIgnoreCase)))
{
return Results.Problem("Provider returned an unexpected content type",
statusCode: StatusCodes.Status502BadGateway);
}
var bytes = await response.Content.ReadAsByteArrayAsync(cancellationToken);
return Results.File(bytes, contentType);
});
app.Run();
The response-header-first option avoids buffering the upstream body before its headers arrive, but ReadAsByteArrayAsync still loads the complete file into memory. For large full-page captures or PDFs, consider streaming the content to storage or a response stream rather than holding many large byte arrays in memory at once.
Configure the key outside source control
For local development, use ASP.NET Core Secret Manager or an environment variable rather than committing a real key in appsettings.json. The configuration key ScreenshotApi:ApiKey maps to the environment variable ScreenshotApi__ApiKey:
Recommended Free Tools
dotnet user-secrets init
dotnet user-secrets set "ScreenshotApi:ApiKey" "YOUR_API_KEY"
# Linux/macOS shell
export ScreenshotApi__ApiKey="YOUR_API_KEY"
In deployed environments, set the equivalent secret through your hosting platform’s secret configuration. Do not expose a server-side API key in browser JavaScript or return it from your route.
Rank #2
- CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
- SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
Return screenshots from an MVC controller
The same request logic can sit behind an MVC action. With a service that fetches and validates the response, the controller’s job is simply to return the bytes with the correct media type:
[ApiController]
[Route("api/[controller]")]
public sealed class ScreenshotController : ControllerBase
{
private readonly ScreenshotClient _screenshots;
public ScreenshotController(ScreenshotClient screenshots)
{
_screenshots = screenshots;
}
[HttpGet]
public async Task<IActionResult> Get(
[FromQuery] string url,
CancellationToken cancellationToken)
{
if (!Uri.TryCreate(url, UriKind.Absolute, out var target) ||
(target.Scheme != Uri.UriSchemeHttp && target.Scheme != Uri.UriSchemeHttps))
{
return BadRequest("url must be an absolute HTTP or HTTPS URL");
}
var capture = await _screenshots.CaptureAsync(target, cancellationToken);
return File(capture.Bytes, capture.ContentType);
}
}
Register controllers with builder.Services.AddControllers() and map them with app.MapControllers(). Do not trust arbitrary input URLs just because they parse correctly: an endpoint that fetches caller-supplied URLs can be abused to reach internal network services. If this is exposed beyond a trusted user group, restrict destinations or use an allowlist appropriate to the application.
Use a typed client for production code
A typed client keeps provider-specific HTTP mechanics out of route handlers, is easier to replace in tests, and lets IHttpClientFactory manage handler lifetimes. This example demonstrates a bearer-authenticated GET returning raw image or PDF bytes. The host, path, query parameters, and authentication scheme must match the provider’s actual API.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallusing System.Net.Http.Headers;
public sealed record ScreenshotResult(byte[] Bytes, string ContentType);
public sealed class ScreenshotClient
{
private readonly HttpClient _http;
private readonly IConfiguration _configuration;
public ScreenshotClient(HttpClient http, IConfiguration configuration)
{
_http = http;
_configuration = configuration;
}
public async Task<ScreenshotResult> CaptureAsync(
Uri target,
CancellationToken cancellationToken)
{
var key = _configuration["ScreenshotApi:ApiKey"];
if (string.IsNullOrWhiteSpace(key))
throw new InvalidOperationException("Screenshot API key is not configured.");
var endpoint = "https://provider.example/v1/screenshot?url=" +
Uri.EscapeDataString(target.ToString());
using var request = new HttpRequestMessage(HttpMethod.Get, endpoint);
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", key);
using var response = await _http.SendAsync(
request, HttpCompletionOption.ResponseHeadersRead, cancellationToken);
response.EnsureSuccessStatusCode();
var type = response.Content.Headers.ContentType?.MediaType;
if (type is null ||
!(type.StartsWith("image/", StringComparison.OrdinalIgnoreCase) ||
type.Equals("application/pdf", StringComparison.OrdinalIgnoreCase)))
{
throw new InvalidOperationException(
$"Unexpected screenshot response content type: {type ?? "missing"}");
}
var bytes = await response.Content.ReadAsByteArrayAsync(cancellationToken);
return new ScreenshotResult(bytes, type);
}
}
// In Program.cs:
builder.Services.AddHttpClient<ScreenshotClient>(client =>
{
client.Timeout = TimeSpan.FromSeconds(90);
});
Set a timeout in line with the provider’s documented capture behavior and your own request budget. A long timeout can tie up incoming requests; a short one can reject legitimate pages that render slowly. For expensive captures, an asynchronous job and callback pattern may fit better than keeping a user’s HTTP request open.
Rank #3
- Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
- Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
- Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
- In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
- Ultra-thin bezels: Maximize your viewing experience with thin bezels.
Match your code to the provider’s response and authentication
Do not assume every screenshot service uses the same API shape. The documented examples in the sources differ:
| Provider | Documented request and response | .NET integration note |
|---|---|---|
| ScreenshotNeo | One GET to the screenshot endpoint returns the requested capture; its supported output and options are described in its docs. | Use ordinary HTTP from ASP.NET Core; see the code example below and ScreenshotNeo documentation. |
| Screenshot API | Its documentation describes GET /v1/screenshot returning raw image bytes, bearer authentication, and a ?key= convenience form. It also documents GET /v1/capture for JSON containing an image and page text. Documentation. |
Choose the endpoint matching whether the application needs raw bytes or the JSON capture data. The documented query-key form should be treated cautiously because URLs may be logged. |
| Screenshot API.org | Its documentation describes POST /api/v1/screenshot, bearer API-key authentication, viewport, format, and full-page parameters. Documentation. |
Send a JSON or form body as specified by its current API documentation, rather than copying a GET sample. |
| ScreenshotAPI.to | Its C# page recommends direct REST calls with built-in HttpClient on .NET 6+ and states, “There’s no official .NET SDK yet.” C# documentation. |
Use the documented REST method and response parsing for the endpoint you select. |
| Screenshot Scout | It publishes an official ScreenshotScout NuGet package and lists .NET 8 or later as a requirement. .NET SDK documentation. |
Use its SDK instructions if you want a provider-maintained .NET wrapper and your application meets the stated runtime requirement. |
Before implementing a provider, verify the HTTP method, credential header, output format, supported image and PDF formats, viewport and full-page controls, JavaScript wait behavior, selector capture, quotas, rate limits, geographic availability, failure semantics, SDK maintenance, and data-retention policy in its own current documentation. The endpoint and SDK facts above do not establish comparable prices, SLAs, or retention terms.
Avoid query-string secrets where possible
Prefer the provider’s recommended authentication header and keep credentials server-side. Screenshot API documentation specifically warns that query-string keys can leak into page source or server logs; its ?key= form is a convenience option, not a good default for a persistent production credential. If a provider only supports query parameters, assess where outbound URLs and logs are stored, restrict log access, and rotate exposed keys promptly.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesWhen the response is JSON or a URL
If the provider returns JSON rather than image bytes, do not pass the JSON body to Results.File. Deserialize its documented response schema, then decide whether to return the provider’s image URL, fetch the image and return it, or expose selected metadata such as extracted text. If it returns base64, decode only the documented field and validate the resulting content type and size before serving it. A URL response may expire or be public, so check its access and retention semantics before storing or sharing it.
Rank #4
- CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
- SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
- MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
- KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
- INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient
Choose capture options that fit the page
Capture parameters control what the remote browser renders and what your application receives. Supported options vary by provider, so treat these as questions to verify rather than a universal parameter list:
- Output: PNG, JPEG, WebP, or PDF; choose a format and quality/size tradeoff the provider actually supports.
- Viewport and device: viewport width and height, device presets, and device scale factor can change responsive layouts and image dimensions.
- Full page or element: full-page capture may load lazy images; selector capture can limit output to a component when supported.
- Readiness: decide whether the capture waits for a selector, a fixed delay, network idle, or a provider default. Network idle is not always proof that a dynamic page is visually complete.
- Authentication and state: some APIs accept custom headers, cookies, or a user agent. Never forward an end user’s credentials to an untrusted capture provider.
- Delivery: raw bytes are convenient for an immediate file response; asynchronous jobs and callbacks can suit slow or bulk work.
Handle failures, timeouts, and rate limits
A screenshot call can fail because the outgoing request failed, the provider rejected a key or parameter, the provider throttled the request, or the target page did not render successfully. Preserve enough detail in server logs to diagnose the issue, but do not log API keys, cookie values, authorization headers, or sensitive target URLs.
Map upstream errors without leaking internals
For a public API, avoid returning the provider’s raw error payload to callers unless you have reviewed it for secrets and implementation details. Log the upstream status code and a safe correlation identifier, then return a useful gateway error. Handle common cases deliberately:
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →- 401 or 403 from provider: check the key, authentication header format, account state, and endpoint permissions. Do not retry unchanged credentials.
- 429: treat it as throttling. Respect a documented
Retry-Aftervalue if present, limit concurrency, and use bounded exponential backoff with jitter for retryable work. - 5xx or network failure: retry only when the provider documents the operation as safe to repeat; cap attempts and total elapsed time.
- Timeout: distinguish your cancellation from an upstream timeout. Tune client timeout and provider render wait settings to the task, and consider background jobs for long captures.
- Bad request: validate URL syntax and supported schemes locally, then verify parameter names and ranges against the provider docs.
- Unexpected content type or empty body: inspect whether the endpoint returned JSON, an error page, or a redirect instead of the expected file.
When using a caller-provided URL, apply outbound request protections: restrict schemes to HTTP/HTTPS, consider allowlisting domains, and block access to loopback, private, link-local, and cloud metadata addresses. Validate redirects too if your application or provider follows them. Otherwise the screenshot route can become a server-side request forgery path into infrastructure the caller should not reach.
Best Value
- 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
- 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
- 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.
Or skip the browser setup
ScreenshotNeo is a screenshot API and MCP server for developers. From ASP.NET Core, you can call it with a normal HTTP client; its endpoint accepts a URL and returns a screenshot or PDF. For production use, obtain and configure an access key as a server-side secret, then call the API as documented at ScreenshotNeo’s API documentation.
using var client = new HttpClient { Timeout = TimeSpan.FromSeconds(90) };
var response = await client.GetAsync(
"https://api.screenshotneo.com/v1/shot?access_key=YOUR_API_KEY&url=" +
Uri.EscapeDataString("https://stripe.com"));
response.EnsureSuccessStatusCode();
var bytes = await response.Content.ReadAsByteArrayAsync();
await File.WriteAllBytesAsync("shot.webp", bytes);
Use a secret store for YOUR_API_KEY, and add any output or capture parameters using the API documentation. Cookie banners, popups, and chat widgets are removed before the shot; bot checks, blank pages, and failed loads are never billed. An MCP server lets AI agents take screenshots. The Free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000. Sign up free for ScreenshotNeo.
Frequently Asked Questions
Does ASP.NET Core need a screenshot-specific .NET SDK?
No. A REST request with HttpClient is sufficient; an SDK is optional and depends on the provider.
Free tools Windows power users keep installed
One-click scans. No signup required.
Can I return a PDF from the same route?
Yes, when the provider supports PDF output: return the bytes with the provider’s PDF content type rather than an image media type.
Why does my endpoint return JSON instead of an image?
The selected endpoint may return structured capture data or a URL. Parse its documented response schema instead of treating every successful response as raw image bytes.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

