This is a simple URL Shortener web application built using ASP.NET Core MVC. The application allows users to create shortened URLs, manage their URLs via a dashboard, and redirect from shortened URLs to the original URLs.
- URL Shortening: Generate shortened URLs for long links.
- User Authentication: Simple email and password authentication using ASP.NET Core Identity.
- Dashboard: Manage your shortened URLs (view, delete).
- ASP.NET Core MVC: Web framework for building web applications.
- ASP.NET Core Identity: For user authentication and management.
- SQLite: Database engine.
- Entity Framework Core: Object-relational mapper (ORM) for interacting with SQLite database.
- BCrypt.Net: For password hashing.
- .NET 8 SDK
- Visual Studio 2022 or any preferred IDE.
git clone https://github.com/naazeri/url-shortener.git
cd url-shortener
No setup is required for SQLite. The database exists in project files: urlshortener.db
dotnet ef database update
Since you are using Dapper, manual migrations are not required unless you've set up a custom process.
dotnet run
- Controllers: Contains the logic to handle HTTP requests and responses.
- Models: Contains the data models used in the application.
- Views: Contains the Razor views for rendering HTML pages.
- Services: Contains services for handling URL shortening and user-specific logic.
- Data: Contains database context and related data classes.
- Register(Optional): Create a new account using your email and password.
- Login: Login with your credentials or defalut user: email:
[email protected]
password:Admin@123
- Create a Short URL: Navigate to the "Create" page and enter the original URL you want to shorten.
- View Your URLs: Go to the dashboard to see your shortened URLs. You can also delete URLs from here.
- Redirect: Access your shortened URLs by navigating to
https://localhost:5001/{shortUrl}
, which will redirect you to the original URL.
- /Account/Register: User registration.
- /Account/Login: User login.
- /Home/Create: Create a new shortened URL.
- /Home/Index: View and manage your URLs.
- /{shortUrl}: Redirect to the original URL.
- Passwords are hashed using BCrypt for security.
- User authentication is required for creating and managing URLs.
Feel free to fork this repository, make changes, and submit a pull request. Contributions are welcome!
This project is licensed under the MIT License. See the LICENSE file for details.