Category "asp.net-mvc"

When using ASP.NET MVC, what is the best way to update multiple page sections with one HTML.Action() method?

I have a pretty big ASP.NET MVC site with 100 controllers and thousands of actions. Previously the header image that was defined on the Site.Master page was ha

Displaying an iframe with @Html.Raw is not working like when displaying Script with @Html.Raw

Note: This is written in asp.net mvc 5. That is the tech I am using for this. I am used to displaying certain data when I use @Html.Raw to show data from a Mode

'HttpClientFactory' does not exist in the current context

I'm writing an application in C#. It pulls the data from Cloudant NoSQL DB. But when I'm trying to create the Http client: HttpClient client = HttpClientFacto

How to effectively change authentication method in ASP. NET web.config?

I am trying to launch ASP.NET project on a local computer. IIS responds with 401.0 status code, stating that "authenticated user does not have access to a resou

Web.config causing "blocked by group policy" error

The myriad of different web.config settings have always been a bit of a mystery to me. I'm glad Microsoft has cleaned up some of the content put there by defaul

How do I post SQL data using submit button in asp.net c# razor

Thanks in advance. Can anyone please help me get this button working so I can display a row from the Northwind database 'only' when the button is clicked. I h

Returning BadRequest in method that returns PartialViewResult

I have an MVC5 application that has a method populates and returns a partial view. Since the method accepts an ID as a parameter, Id like to return an error if

How to Bind a group by data in view in mvc5? what are the best ways to do

I am using Entityframework context, i dont know how to bind to view. I am grouping items by gender public SQLChallengeEntities Sqlcontext = new SQLChallengeEn

How to set up a stub and assigning a webresponse with Rhino mocking

I'm completely new to Rhino Mocks and mocking in general. I'm still wrapping my head around how to code the mocks. I have a test class which contains something

"Select all" in Kendo MultiSelect (MVC)

I have a Kendo Grid with some custom editors, one is a multiselect. I have a cshtml file for the editor that looks like so: @model IEnumerable<ManageSitesInT

How to make script fire only once when a URL is accessed Google Conversion Tracking

I am using Google Ads to track purchase conversions on my Ecommerce website. When a user clicks on my Google Ad for a product and then makes the purchase and la

Scaffold-DbContext failed to build, how do i resolve this issue on Nuget console?

I have installed all required packages for this command, when i try to run this command on my console its failed to build. Kindly please assist to resolve this

Unable to resolve service for type Microsoft.EntityFrameworkCore.DbContextOptions

When I want to add controller using ASP.NET Core MVC with views: enter image description here This is my DbContext class: namespace Infrastructure { public

<label> element splits to multiple lines

I have a <label> element in my ASP.NET core MVC project, that splits to multiple lines instead of showing in a single line. I've inspected the element in

System.FormatException: Input string was not in a correct format. MVC5

Here is my code: string idString = System.Web.HttpContext.Current.User.Identity.Name; int customerID = int.Parse(idString); Customer customer = db.Customers.

.NET Core 6 Windows auth and Active Directory group based permissions

I am learning dotnet core 6, and making application for Intra. I need to get user data (user name and surname, and user groups) from company's Active Directory

How to automatically upload file after file has been chosen

I have the following code for uploading a file in my site: @using (Html.BeginForm("UploadProfileImage", "Member", FormMethod.Post, new { @encType = "multipart/

Executing an exe in SQL job which generates pdf and mail

I've an windows app in server which collects data from db and renders pdf via another third party .exe and mails the pdf. I scheduled the exe to run on SQL job.

What's the difference between Render and GetHtml methods in DevExpress?

I would like to know whats the difference between using the method Render vs. using the method GetHtml, when using the DevExpress MVC Extensions? I know that Ge

Views not found after migrating to .NET 6

I migrated an ASP.NET CORE MVC project from .NET Core 2.1 to .NET 6. After making relevant changes, the project compiles and starts seemingly OK, but the views