What is MIME type "text/x-vbnet"?

A MIME type is a string that tells browsers and other tools how to handle a particular kind of file.

text/x-vbnet indicates files containing Visual Basic .NET source code. It designates plain text files written using VB.NET syntax.
When a development tool or web server sees a file marked with this MIME type—like one with the VB extension—it knows to treat it as a code file that can benefit from syntax highlighting and other language-specific features.
Its use streamlines the process of managing and editing code by clearly identifying the file format and language rules.

Associated file extensions

Usage Examples

HTTP Header

When serving content with this MIME type, set the Content-Type header:


    Content-Type: text/x-vbnet    
  

HTML

In HTML, you can specify the MIME type in various elements:


    <a href="file.dat" type="text/x-vbnet">Download file</a>    
  

Server-side (Node.js)

Setting the Content-Type header in Node.js:


    const http = require('http');    
    
    http.createServer((req, res) => {    
      res.setHeader('Content-Type', 'text/x-vbnet');    
      res.end('Content here');    
    }).listen(3000);    
  

Associated file extensions

FAQs

What is the text/x-vbnet MIME type used for?

text/x-vbnet identifies files containing Visual Basic .NET source code. It allows text editors and IDEs to recognize the content as code, enabling features like syntax highlighting and IntelliSense for files typically ending in .vb.

How do I open a file with the text/x-vbnet content type?

You should use a dedicated development environment like Microsoft Visual Studio or a code editor like Visual Studio Code. Since these files contain plain text, you can also view them in basic editors like Notepad, though you will lack compilation and debugging tools.

Is text/x-vbnet an official standard MIME type?

No, the x- prefix indicates that it is a non-standard or experimental type used by convention. While not registered with IANA, it is widely used by applications to distinguish VB.NET code from generic text files.

How do I configure IIS to serve .vb files correctly?

In Internet Information Services (IIS), navigate to the MIME Types feature for your site and add a new entry. Set the file extension to .vb and the MIME type to text/x-vbnet (or text/plain for broader compatibility) to ensure browsers handle the response headers correctly.

Can I run a text/x-vbnet file directly in Windows?

No, files marked with this MIME type are source code and cannot be executed directly. They must first be compiled by the .NET compiler (vbc.exe) into an executable binary (like an .exe or .dll) before the computer can run the program.

Why does my browser download the .vb file instead of displaying it?

Most browsers do not have a built-in renderer for VB.NET syntax and treat unknown x- types as binary files to be saved. To force the browser to display the code, the server must send a Content-Disposition: inline header, or serve the file as text/plain.

What are the security implications of serving text/x-vbnet files?

Serving raw source code files publicly can expose intellectual property, internal logic, and potentially sensitive data like connection strings. You should generally configure your web server to block requests to source files unless you are specifically hosting a code repository.

General FAQ

What is a MIME type?

A MIME (Multipurpose Internet Mail Extensions) type is a standard that indicates the nature and format of a document, file, or assortment of bytes. MIME types are defined and standardized in IETF's RFC 6838.

MIME types are important because they help browsers and servers understand how to process a file. When a browser receives a file from a server, it uses the MIME type to determine how to display or handle the content, whether it's an image to display, a PDF to open in a viewer, or a video to play.

MIME types consist of a type and a subtype, separated by a slash (e.g., text/html, image/jpeg, application/pdf). Some MIME types also include optional parameters.

How do I find the MIME type for a file?

You can check the file extension or use a file identification tool such as file --mime-type on the command line. Many programming languages also provide libraries to detect MIME types.

Why are multiple MIME types listed for one extension?

Different applications and historical conventions may use alternative MIME identifiers for the same kind of file. Showing them all helps ensure compatibility across systems.