Page cover
For the complete documentation index, see llms.txt. This page is also available as Markdown.

asp/x

01. Enumarate MSSQL database

  • Show all databases

<%@ Page Language="C#" %>
<%@ Import Namespace="System.Data.SqlClient" %>

<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        string connectionString = "Server=tcp:<server_name>.database.windows.net,1433;Initial Catalog=<database_name>;Persist Security Info=False;User ID=<username>;Password=<password>;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;";
        using (SqlConnection connection = new SqlConnection(connectionString))
        {
            connection.Open();
            SqlCommand command = new SqlCommand("SELECT name FROM sys.databases", connection);
            SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                Response.Write(reader[0].ToString() + "<br>");
            }
            reader.Close();
            connection.Close();
        }
    }
</script>

<html>
<body>
    <form id="form1" runat="server">
        <div>
            <h1>List of Databases</h1>
        </div>
    </form>
</body>
</html>
  • List all tables from database

  • Dump data from table

  • Dump specific database

  • Dump all database

Last updated