Chatbots are powerful tools for improving user experience on digital platforms. In this blog, I’ll take you through how I created a simple e-commerce chatbot using ASP.NET (Web Forms) and SQL Server that helps users get instant answers about digital products like planners, templates, and file types without using any third-party AI libraries.
What does this Chatbot do?
- Responds to product-related user queries using predefined keywords
- Displays a friendly chat UI with user-bot interaction
- Store each conversation in a chat log table for analysis
- Uses SQL queries to retrieve responses based on keyword match
- Fully functional without JavaScript or AJAX
Tech Stack
- Frontend: ASP.NET Web Forms, Bootstrap 5
- Backend: C# (.NET Framework), ADO.NET
- Database: Microsoft SQL Server
- Tables Used
- BootResponses: Stores bot responses
- ChatLogs: Stores chat history
UI Design (ChatBoot.aspx)
The chatbot is placed inside a styled Bootstrap card. Here's the code.
<div class="chat-wrapper">
<div class="chat-header">
<h5>E-Commerce Chatbot - Ask Me About Products!</h5>
</div>
<div class="chat-body" id="chatBody" runat="server">
</div>
<div class="chat-footer">
<asp:TextBox
ID="txtUserInput"
runat="server"
CssClass="form-control"
placeholder="Type your question...">
</asp:TextBox>
<asp:Button
ID="btnSend"
runat="server"
Text="Send"
CssClass="btn btn-primary"
OnClick="btnSend_Click" />
</div>
</div>
Here’s how the UI looks.
Screenshots

Backend Logic (ChatBoot.aspx.cs)
On Page_Load, I show a friendly welcome message and sample questions.
chatBody.InnerHtml += @"
<div class='bot-msg'>
Welcome! I'm your assistant bot for digital product shopping and selling.<br/>
Try asking:
<ul>
<li>What templates do you have?</li>
<li>How to list my product?</li>
<li>Steps to buy a planner?</li>
</ul>
</div>";
When the user clicks "Send", the bot checks the database for matching keywords.
string query = @"
SELECT TOP 1 ResponseText
FROM BootResponses
WHERE @msg LIKE '%' + QuestionKeyword + '%'";





Join the conversation! Your thoughts help the community grow.