Code2night
  • Home
  • Guest Posts
  • Tutorial
  • Languages
    • Angular
    • C
    • C#
    • HTML/CSS
    • Java
    • JavaScript
    • Node.js
    • Python
    • React
    • SQL Server
    • TypeScript
  • Post Blog
  • Tools
    • JSON Beautifier
    • HTML Beautifier
    • XML Beautifier
    • CSS Beautifier
    • JS Beautifier
    • PDF Editor
  • Register
  • Login
  1. Home
  2. Blogpost

Using Firebase Database in Asp.Net

Date- Sep 22,2022

9956

Free Download Pay & Download
Firebase Firebase Database

FireBase Database

Firebase is used with mobile and web applications in order to have better performance across mobile devices.For saving the data to Firebase database from Asp.net Web application we have to first create firebase database and we have to signup to firebase console for that purpose.After going to firebase console signup with Firebase console and follow these steps:

1. First of all click on create a project.

2. Now enter the data as showed in the below screenshot

3. Now click on continue

4. Select your location and click on create project

5. Now you project will be started to create. It can take few seconds. Click on continue

6. Now your project is created and click on the code icon as showed in the image

7. Now you have to add new app in your project.

8. Click on next

9. Click on next again

10. Click on continue to console

11. Now  click on the settings icon as showed below


12.Now click on realtime database and create database

13. Now select the dropdown and click on the button 

14. Click on the test mode and click on the button

15. Click on the button again and your database will be created

12. Now click on service accounts tab

13. Now click on the highlighted tab  and you can copy the secret key that you will use later in the code part . These are the database secret key that we have to use in our Asp.Net application

Asp.Net Project

Now we will create new asp.net mvc project and add FireSharp Nuget package

We will use this package for sending the data to firebase database

Now create one new action and copy the code below


using FireSharp.Config;
using FireSharp.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Firebase.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            string authSecret = "5VBhC2rR7q7bC8ag42Ejr3f2TcOerJxIpuPRUzxQ"; //Enter your database secret here
            string basePath = "https://code2night-8d351-default-rtdb.firebaseio.com/"; //Enter your database url
            string senderAppName = "Code2night"; 

            IFirebaseClient client;
            IFirebaseConfig config = new FirebaseConfig
            {
                AuthSecret = authSecret,
                BasePath = basePath

            };

            client = new FireSharp.FirebaseClient(config);
            if (client != null && !string.IsNullOrEmpty(basePath) && !string.IsNullOrEmpty(authSecret))
            {

                var data = new 
                {
                    Name="Test",
                    Mobile="234234"
                };

                var response = client.Push("doc/", data);
            }
            return View();
        }
        
    
    }
}

Now we have to run the application and you will see our data will be saved to firebase database. You can check the output in the screenshot below

So, this is how we will be using Firebase database in Asp.Net web application. 

Comments

Tags

Swagger UI
Swashbuckle
SwashbuckleAspNetCore
Rest API
Postman
Api Testing
ITextSharp
Export to Pdf
AspNet Core
AspNet
C#
View to Pdf in Aspnet
Scheduler
Fibonacci series in Java
Display Fibonacci Series
First C# Program
What is C?
C
C Programming
CodeLobster
Free Download for Youtube Subscribers!

First click on Subscribe Now and then subscribe the channel and come back here.
Then Click on "Verify and Download" button for download link

Subscribe Now | 1760
Download
Support Us....!

Please Subscribe to support us

Thank you for Downloading....!

Please Subscribe to support us

Continue with Downloading
Be a Member
Join Us On Whatsapp Join Us On Facebook
Code2Night

A community platform for sharing programming knowledge, tutorials, and blogs. Learn, write, and grow with developers worldwide.

Panipat, India   info@code2night.com

Quick Links
  • Home
  • Blogs
  • Tutorials
  • About Us
  • Contact
  • Privacy Policy
  • Terms & Conditions
  • Guest Posts
Dev Tools
  • JSON Beautifier
  • HTML Beautifier
  • XML Beautifier
  • CSS Beautifier
  • JS Beautifier
  • PDF Editor
By Language
  • Angular
  • C
  • C#
  • HTML/CSS
  • Java
  • JavaScript
  • Node.js
  • Python
  • React
  • SQL Server
  • TypeScript
© 2026 Code2Night. All Rights Reserved.
Built with for developers