mvc
58 TopicsIntroducing PASS — Project Aware Smart Scaffolder for ASP.NET Core MVC
Hello .NET Community! I would like to introduce an independent software architecture and research initiative that I have been developing: PASS (Project Aware Smart Scaffolder). The central idea behind this initiative is to explore an important challenge in database-first ASP.NET Core MVC development: How can developers regenerate scaffolded code after database or project changes without losing their existing customizations and business logic? 1. The problem: The scaffolding paradox Microsoft's existing scaffolding capabilities provide an excellent starting point for generating application code. However, in an iterative development environment, developers frequently customize generated models, controllers, views and other application components. When the underlying database schema changes, regenerating these components can introduce conflicts with existing custom implementations. Developers may consequently need to: Manually reconcile generated and customized code. Reapply previously implemented business logic. Maintain additional conventions and project-specific configurations. Avoid regeneration because of the potential impact on existing work. This creates an interesting architectural challenge: How can scaffolding remain useful throughout the entire application lifecycle rather than primarily during initial code generation? 2. The proposed approach: PASS PASS explores a deterministic, database-aware, project-aware and non-destructive scaffolding architecture intended to complement Microsoft's existing scaffolding capabilities rather than replace them. Its proposed architectural concepts include: Persistent project configuration — pass.json A centralized configuration file intended to preserve project-specific conventions, generation preferences and architectural decisions. Roslyn-based syntax-tree analysis and merging Exploring C# Abstract Syntax Trees (ASTs) to identify structural changes and reconcile generated code while preserving compatible custom implementations. Project awareness Considering existing project structure, naming conventions, architectural decisions and dependencies when generating or updating code. Database awareness Using database schema changes as inputs for identifying required code-generation updates. Non-destructive regeneration The overall objective is to reduce unnecessary overwriting of developer-maintained code during subsequent scaffolding operations. 3. Current research status PASS is currently in its Research & RFC (Request for Comments) phase. The repository contains architectural and research documentation, including: Research Proposal Methodology & Evaluation Plan System Architecture Roslyn Merging Strategy RFC-0001: Community Discussion The project is not being presented as a completed or production-ready implementation. The current priority is to validate the architectural assumptions, identify technical limitations and obtain feedback before proceeding with implementation. Project repository and research documentation: https://github.com/RashedulHaqueRonjon/PASS-Framework/ 4. Topics where I would particularly appreciate community feedback I would welcome perspectives from experienced C#, ASP.NET Core MVC, Entity Framework Core and Roslyn developers on the following architectural questions: What would be the most reliable strategy for distinguishing generated code from developer-maintained custom code? Which Roslyn syntax-tree analysis and merging approaches would be appropriate for safely reconciling existing C# files? How should the architecture handle conflicting changes between database-generated properties and manually maintained model implementations? What safeguards should be considered before automatically applying changes to existing project files? Would a persistent project configuration file such as pass.json be an effective way to preserve project-specific scaffolding conventions? What testing and evaluation criteria would you recommend before considering such a framework technically reliable? 5. An invitation to the .NET community I believe that improving the sustainability of code generation is a worthwhile area of exploration for the ASP.NET Core ecosystem. I would particularly appreciate constructive architectural criticism, alternative approaches, technical recommendations and suggestions for improving the research methodology. This is an independent research initiative, and the objective at this stage is to learn from the experience of the .NET community. Thank you for your time and consideration. Rashedul Haque Ronjon Independent Researcher91Views0likes3CommentsAllowAnonymous attribute not working
Hi, I have a .NET Core 10 MVC web app and I want to create views that can be viewed without requiring login. I have tried adding [AllowAnonymous] both to my controller and to individual views, but the user always gets redirected to the login screen. I am thinking that it must be due to the setup in my Program.cs. Here is my Program.cs : var builder = WebApplication.CreateBuilder(args); // Add services to the container. var connectionString = builder.Configuration.GetConnectionString("DefaultConnection") ?? throw new InvalidOperationException("Connection string 'DefaultConnection' not found."); builder.Services.AddDbContext<ApplicationDbContext>( options => options.UseSqlServer( builder.Configuration.GetConnectionString("DefaultConnection"), x => x.MigrationsAssembly("PBP"))); builder.Services.AddDatabaseDeveloperPageExceptionFilter(); builder.Services.AddIdentity<ApplicationUser, IdentityRole>(options => options.SignIn.RequireConfirmedAccount = true) .AddEntityFrameworkStores<ApplicationDbContext>() .AddDefaultUI() .AddDefaultTokenProviders(); //require this for editing syncfusion datagrid builder.Services.AddMvc().AddNewtonsoftJson(options => { options.SerializerSettings.ContractResolver = new DefaultContractResolver(); }); builder.Services.AddTransient<IEmailSender, EmailSender>(); builder.Services.Configure<AuthMessageSenderOptions>(builder.Configuration); builder.Services.AddTransient<SessionHelper>(); builder.Services.AddApplicationInsightsTelemetry(new Microsoft.ApplicationInsights.AspNetCore.Extensions.ApplicationInsightsServiceOptions { ConnectionString = builder.Configuration["APPLICATIONINSIGHTS_CONNECTION_STRING"] }); //session //https://learn.microsoft.com/en-us/aspnet/core/fundamentals/app-state?view=aspnetcore-7.0 builder.Services.AddDistributedMemoryCache(); builder.Services.AddSession(options => { options.IdleTimeout = TimeSpan.FromSeconds(1200); options.Cookie.Name = ".PBP.Session"; options.Cookie.IsEssential = true; }); builder.Services.ConfigureApplicationCookie(options => { //options.ExpireTimeSpan = TimeSpan.FromSeconds(1800); //default is 14 days options.LoginPath = "/Identity/Account/Login"; options.SlidingExpiration = true; }); var app = builder.Build(); // Configure the HTTP request pipeline. if (app.Environment.IsDevelopment()) { app.UseMigrationsEndPoint(); } else { app.UseExceptionHandler("/Home/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } app.UseHttpsRedirection(); app.MapStaticAssets(); app.UseRouting(); app.UseAuthorization(); app.UseSession(); app.UseForwardedHeaders(new ForwardedHeadersOptions { ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto }); app.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}").WithStaticAssets(); app.MapRazorPages().WithStaticAssets(); app.Run(); Can anybody advise me on if this is the issue and if so what changes I need to make so that I can successfully use AllowAnonymous? Many thanks, Mike601Views0likes3CommentsIt appears and error that does not exist
I am using VS 2022 Community and when i develope asp.net apps it happens sometimes that it appears an error that does not exist adn only after many hours of searching for the error or rewriting the same code the app begins to run correctly. Somehitng simmilar happened to any of you ? how can i avoid these strange behaviour of the compiler ? Thank you in advance Luis Martin453Views0likes1CommentOpen Source Materio Asp.NET Core MVC Admin Dashboard Template
https://themeselection.com/item/materio-free-aspnet-core-mvc-admin-template/ Hi All, Sharing here https://themeselection.com/item/materio-free-aspnet-core-mvc-admin-template/ If you’re a developer looking for the latest Free ASP.NET Core 8, MVC 5 Admin Panel Template that is developer-friendly, rich with features, and highly customizable look no further than Sneat. Incredibly versatile, this https://themeselection.com/item/category/asp-net-dashboard/ also allows you to build any type of web application. For instance, you can create: SaaS platforms Project management apps E-commerce backends CRM systems Analytics apps Banking apps Education apps Fitness apps & many more. Features: Based on ASP.NET Core 8, MVC 5 UI Framework Bootstrap 5 Vertical layout 1 Unique Dashboard 1 Chart library SASS Powered Authentication Pages Fully Responsive Layout Organized Folder Structure Clean & Commented Code Well Documented You can check the GitHub repo as well: https://github.com/themeselection/sneat-bootstrap-html-aspnet-core-mvc-admin-template-free13KViews2likes1CommentBuild Scalable Web Apps and APIs with ASP.NET Core, Blazor, Angular for Modern Web Apps
I’m starting this discussion because many developers today need guidance on how to build modern, scalable web applications and APIs by combining ASP.NET Core, Blazor, and Angular—three powerful technologies within the .NET ecosystem. Whether you're focused on server-side development, creating dynamic client-side apps, or integrating both, these frameworks provide incredible capabilities to enhance your projects ASP.NET Core for API Development: ASP.NET Core is a robust, high-performance framework that allows you to create powerful APIs. Some of the best practices we’ll cover include: - Designing RESTful APIs with ASP.NET Core - Utilizing Entity Framework Core for efficient database access - Securing APIs with JWT and OAuth - Handling asynchronous requests for optimal performance - Implementing API versioning and changes over time Building Dynamic Web Apps with Blazor: Blazor enables you to create interactive web applications using C# instead of JavaScript. We will discuss: - Blazor Web Assembly vs. Blazor Server: Differences and use cases - Creating reusable Blazor components for UI - Integrating third-party JavaScript libraries with Blazor - Using SignalR for real-time features - Optimizing Blazor for performance Angular for Full-Featured Client-Side Development: Angular is a powerful, full-featured front-end framework that excels in creating dynamic and complex user interfaces. In this section, we'll dive into: - Why you might choose Angular over Blazor in certain cases - Using Angular CLI to scaffold, build, and maintain apps - Managing state in Angular with NgRx or RxJS - Connecting Angular with ASP.NET Core APIs for data handling - Working with Angular components, services, and routing for a seamless user experience Combining Angular and Blazor in a Single Application: You may have use cases where you want to combine both Blazor and Angular in one application to leverage the strengths of each framework: - When to use Angular for complex frontend features (e.g., dynamic forms, complex data visualization) and Blazor for simpler components or backend-heavy apps. - Managing communication between Angular and Blazor components in a single page (e.g., using - JavaScript Interop to pass data between the two). - Handling authentication and state management across both frameworks. Integration between Frontend (Blazor/Angular) and Backend (ASP.NET Core): No matter whether you're using Angular or Blazor for the frontend, integrating these with your backend API is key. We'll discuss: - Setting up HttpClient for making API calls from both Blazor and Angular - Working with SignalR to enable real-time features in both frontends - Managing authentication and authorization across both Angular and Blazor (JWT, OAuth) - Best practices for passing data and sharing state between the frontend and backend Scalable and Maintainable Web Apps: When building full-stack web applications, it's important to focus on scalability and maintainability. Here are some practices for achieving this: - Structuring your application code to separate concerns (e.g., services, components, repositories) - Utilizing Dependency Injection for flexible and testable code - Modularizing your codebase for easier updates and maintenance - Using Lazy Loading for Angular and Blazor components to improve performance - Leveraging Caching strategies to enhance response times Testing and Continuous Deployment: For any modern application, testing and deployment are crucial. We’ll discuss: - Unit and integration testing in ASP.NET Core, Blazor, and Angular - Automated end-to-end testing (e.g., with Cypress for Angular, bUnit for Blazor) - Continuous Integration/Continuous Deployment (CI/CD) strategies for seamless deployment to cloud platforms like Azure or AWS When to Choose Angular, Blazor, or Both: It’s essential and interesting to know when to use each of these frameworks depending on your project’s needs. Some scenarios we’ll explore: - When to go for Blazor for a unified C# experience in both frontend and backend - Why you might opt for Angular when building highly interactive, feature-rich web applications - Hybrid approaches where you can use Blazor and Angular together for a robust full-stack solution SO: Combining ASP.NET Core, Blazor, and Angular allows developers to choose the right tool for the right job, creating flexible, scalable, and maintainable web applications. Whether you’re leveraging Blazor for its deep integration with .NET or Angular for its powerful frontend capabilities, these technologies offer a powerful suite of tools to build modern web applications. What are your thoughts? How have you integrated Angular or Blazor with ASP.NET Core in your projects? Share your experiences and challenges, and let's collaborate on solutions!1.4KViews9likes5CommentsImplementation SMTP using MailKit in ASP .NET Core MVC
I am developing a web development project, where I have to implement email trigger along with message. Suppose there is a form where users will put thier name, email, title and message. After hitting submit button it will automatically send the message to the owner. How can I achieve this in latest version of this framework. And MailKit is Version 4.11.0.291Views0likes0CommentsNeed Advice on Asp.Net MVC project
Hey, I just need advice on my first project. I am highly frustrated rn. I dont know where to start. I am creating a web-application on Asp.Net MVC using Entity framework with SQL server Till now: I find the template and created the layout and index page on mvc Its only me on the project. Its about a week and i am really losing my mind how to connect each dots(specification). To complete my project. I have some question. I am sorry, i dont think, so this is the right platform for this or not. I dont want to waste anyone time here. Thanks for your time and consideration.945Views0likes2CommentsHow to increase session timeout
Hello Everyone, I am working on .NET framework 4.8 with a MVC web application. To login I am using MFA with microsoft's openid-configuration method. When I create FormsAuthenticationTicket and try to set session timeout as per my requirement but it doesn't work. See the sample code as below FormsAuthenticationTicket ticket1 = new FormsAuthenticationTicket( 1, // version adminEmail, // get username from the form DateTime.Now, // issue time is now DateTime.Now.AddDays(365), true, // cookie is not persistent "XXXXX" // role assignment is stored in userData ); But it is not working properly, it gets timeout within 15 mins266Views0likes0Commentsajax and connection to mvc .net
I need to access some c# code from javascript in MVC ,NET (not blazor). I have the below. This is very specific to .NET and MVC stack and not a generic ajax question like another one in stack overfow. I get no error message it just continues to the next statement after the ajax call. There could be 2 possible issues i think. My url: '/Home/CreatePostcodeFromCoordinates', is wrong. Or my C# assembly is not part of the assembly? or something similar. I am not that experienced with Web techs, I come from a DB background but can't be that difficult to get this link working right? Can't see anything else wrong. Also does the return value from C# need to be some special format or a string (as per now) is ok? this could be another reason? Thank you! console.log("just before /Home/CreatePostcodeFromCoordinates"); $.ajax({ type: "POST", url: '/Home/CreatePostcodeFromCoordinates', data: { param1: longitude, param2: latitude }, success: function (response) { console.log('success'); console.log(response); }, error: function (error) { console.error(error); } });Solved568Views0likes1CommentOpenstreet maps on azure websites
Hi, I am at the beginning of starting my own project. I come from a database tech background and have not kept up to date with all the Web frameworks. The project will run on azure and I will use visual studio. I need to be able to access opensteet maps for mapping and coordinates. So what I need to do is go to open street maps. Click somewhere on the map and a special tag should come up which I am populating in c# based on coordinates and country. I will to do the same on android, ios. Is xanarin my best option here? So there is MVC, the new .net core, web forms, some other framework. I didn't particularly like the .net core as there seems to be no designer with toolbox and components. Or do I use umbraco framework. I also saw a project called OSMsharp on github. What .net tech should I go for as I have to use openstreetmap and no Google maps, am i limited by this?. Thank you! Panos353Views0likes0Comments