Newest 'asp.net-mvc' Questions

Q&A for professional and enthusiast programmers

Rally Authentication issue in Getting results

I am using asp.net MVC application and consuming Rally web API for integration. I want fetch the data from rally site. in Login Controller RallyRestApi restApi = new RallyRestApi(...

Report Error in the software (aspnet mvc) [on hold]

Hi I have clockwise finger print software. Datepicker with from and to dates is there and when we click generate report within those dates is created. But from Jan 1, 2017 no data shown in report. ...

Can't switch of “validation input” and getting error message .net

Tried: [ValidateInput(false)] public class MatchesController : ApiController In web.config I have: <httpRuntime requestValidationMode="2.0" targetFramework="4.5.2"/> <pages ...

Is it required to install MS excel on server to run Macros from a web application?

I have an Excel which has some macros. I need to execute those Macro from a MVC web application. Do I need to install MS Excel on server ?

Package 'Microsoft.Extensions.SecretManager.Tools 1.1.0-preview4-final' has a package type 'DotnetCliTool'

FalconWebsite.csproj <ItemGroup> <PackageReference Include="knockoutjs" Version="3.4.1" /> <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0-...

cannot convert from 'System.Collections.Generic.IEnumerable<x>' to 'x' when using auto mapper

i have NewsViewModel , it include : public class CategoryViewModel { public CategoryViewModel() { List = new List<CategoryModel>(); } public IEnumerable<CategoryModel&...

Getting full request url - ASP.NET MVC

I have request to server like : "http://localhost/Login/Index?asdhkjashdaskjdhqwehw". And my Action : public ActionResult Index() { stringUrl = ; return RedirectToAction("Index","Home"); } ...

Card game design and MVC [on hold]

I am trying to learn MVC C# by writing a small card game. I am getting stuck with a design issue. At the start of the game I need to deal cards to all the players. If the Game has 4 players and the ...

Visual Studio 2015 enable MVC 4 support

I have an ASP NET MVC 4 project that "works on my machine(old)". When I load a project in a fresh installation of VS 2015(on a new laptop) - a lot of assemblies are missing and when I try to build the ...

Ajax request called mutiple times in mvc

Whenever I tried to render partial view on bootstrap modal, the ajax request which is rendering the partial view is getting called multiple times. I am making ajax request on button click which is on ...

NullReferenceException occurs in DropDownListFor , ASP.NET MVC [duplicate]

I am new to ASP.NET MVC.I am working with a sample Project using Individual User Accounts. I created a new Area in my project folder and it contains UserManagement Folder. It contains a file named ...

Add a Link to a Datatable in c# MVC 5 before passing it to a view

Today i need to add a link to one of my tables columns. The table is created as a datatable in my controller, in which it is populated by a database query and then sent to the view. There are quite a ...

MVC 5 Url rewrite exact match only

I have a virtual directory on my site that no longer exisits /app i want to redirect all requests to this to the home page but only if its exactly the url /app i tried the following but this also ...

upload multiple file with jquery ajax in asp mvc

i use this code for upload single file . jQuery Ajax : $(document).ready(function () { $('input[type=file]').change(function () { $(this).simpleUpload("/Admin/News/GetFile", { ...

Why function not fired when I make seletion?

I work on my mvc 5 project. I have ul li element. When I make selection from ul element I want to fire jquery function and implement postback call. I have this HTML code: <ul class="top-...

Debug=“false” breaks bundling

Over the weekend we have deployed a new version of an MVC web application to a Windows Server hosted in IIS 6. All of the CSS and Jquery files are configured to use bundling, on first deployment none ...

HTML form without CSRF protection alert (Acunetix)

I use in my form @Html.AntiForgeryToken() and in action I use [ValidateAntiForgeryToken] attribute but when test my site by Acunetix get this error : HTML form without CSRF protection html : &...

populate form fields by selecting drop down list in .net mvc without using javascript

I want to populate form fields by selecting the drop down list without using java script. I have model class name workcenter and i am using list of plant class as data member.below is my code. please ...

What is the difference between IWindsorContainer vs IUnityContainer?

I've worked with both 2 types of container between IWindsorContainer and IUnityContainer in different project for service and Interface binding. However I am not pretty sure what are the differences? ...

Allow to see/edit specific fields for specific roles

Good day. I have many users, many roles, many models, cookie auth, ASP.NET Core. I need to restrict access to specific fields of the model for each role. For example: class ModelA { public int Id {...

How can I pass data from view to controller using ajax?

Code in view: function DeleteSelected() { var data = "ID="; $("input[type=checkbox]").each(function () { if ($(this).attr('name') == "IDS[]") { if ($(this).prop('checked')...

SignalR Server side method call from Client side in Non MVC project

I'm familiar with WebMethods and PageMethods to call Server side methods from the client side without refreshing page. I'm achieving to Invoke Server-side method (present inside index.aspx.cs). Here ...

What is the correct lambda expression to return hierarchical data

I'm using Entity Framework with the following SQL table Table TestParentChilds: id name parent ------------------ 1 John null 2 Bill 1 3 Jane 2 4 Bob 2 id is the primary ...

Fluent Validation and Unity: ValidatorFactory.CreateInstane is called many times in MVC web application

In the MVC project im working I use Fluent Validation to implement some validation logics and I defined my UnityValidatorFactory as following: public class UnityValidatorFactory : ...

ResourceProviderFactory being ignored

I have created a resource provider factory and a resource provider in my MVC 5 application. I have added it to the web.config <globalization resourceProviderFactoryType="MyApplication....

c# mvc, keep model binding alive for view

I have a complex view with List (rows on UI). I need to have possibility to add new rows and then submit whole model. Each row is a @Html.EditorFor <div id="timesheetDates"> @for ...

How To Get UserId() Method From ASP.NET Identity Directly in Razor

I've this issue with Custom Authorization some parts of my Views (which i don't want to put on PartialView), instead I am using If statement like below: @if (item.CurrentComment.Id == Guid.Parse(...

not enter in controller when using script of create input file for upload

i need to use dynamic upload form . i used this script for add input file in asp mvc : <button type="button" onclick="adduploadfile()" class="btn btn-success">افزودن فایل</button> * ...

Manually remove Auth Cookie from .Net MVC Application

One of my recent .Net MVC based web application i have a situation by which i need to use multiple auth cookie like 1 Forms Auth Cookie FormsAuthenticationTicket ticket = new ...

How to fix error: resources file not found on run time?

I have Resource file in my MVC5 project. I use the resources files for localization. Here is properties window of the resource file: And here is Person class: public class Person { [Display(...

Architect ASP.NET MVC with Polymer

I have built already 3 apps using ASP.NET MVC and Polymer but I always end up with the same architectural problem. At the moment, if I want to keep separated the MVC Views from the Polymer ...

call javascript on document ready and partial view load complete

I have a a page divided into 2 parts. One to show filter with checkbox and other for displaying content having paragraph. On page load I will display the filter and paragraph content. On click of ...

mvc asp multiple bootstrap modals (opened with href=“@Url.Action()”)

Introduction: Hi, I'm new to Stackoverflow, any feedback apprichiated. I'm working on a larger mvc asp project and my problem concerns Views, modals and bootstrap. I created a website creating the ...

window azure Unable to make the session state request to the session state server

could please tell me how to resolve this error in windows azure. In my localhost system, code is working fine but windows azure application is not working its throwing error. Unable to make the ...

How to import Users from Office 365 programatically

in my website we have one option like login with office365, we are using OAuth2 for this and it is working for me, Here what i need is, i am having the user email address who is login with office365 ...

Asp.Net Mvc Selectpicker

I am trying to implement a DropDownList Multi Select using Bootstrap Selectpicker for selecting Schools in my application. I am not very familiar with MVC and JQuery since i have been using webforms ...

System.MissingMethodException: Method not found: 'System.String System.CodeDom.Compiler.CompilerParameters.get_CoreAssemblyFileName()'

My Asp.Net MVC application is working fine on my machine (IIS). When I deployed this on Windows Server 2008 R2 IIS, I am getting below error: [MissingMethodException: Method not found: 'System.String ...

Error Handling for ASP.NET MVC Application does not display error page correclty

My production server does not allow to display error details (as i guess since setting custom errors off did not help). So I tried to use built in error handling feature of application. I have below ...

C# MVC Razor 5: location.href in an ajax call

I have a solution in my MVC project which allows me to show and/or hide a loading screen whenever I want to: $("#divLoading").show(); $("#divLoading").hide(); This "divLoading" essentially contains ...

.Net Mvc Swashbuckle own Index.page not rendering properly no javascript no css .Net Mvc Web Api

i making my own index page in swashbuckle in .net mvc web api. i copied source code from this link https://github.com/domaindrivendev/Swashbuckle/blob/master/Swashbuckle.Core/SwaggerUi/CustomAssets/...

Universal Analytics - Individual Page Tracking - MVC 3

I have an MVC(3) application and implemented universal analytics. I have copied Tracking Code in Layout page but it tracks only landing page hits and sometimes tracks other pages. I would like to ...

Data Validations in ASP.net MVC application

I am working in one application with asp.net in MVC. Now I have to provide validations for each and every input. As I am new to MVC and not much idea about how to provide validations. Can anyone help ...

ActionFilterAttribute application level

I've created a new class called LogAttribute that extends from the ActionFilterAttribute class. I did override the four methods : OnActionExecuted, OnActionExecuting, OnResultExecuted and ...

best way for compress insert code in controller

i create this controller for insert news . how can i compress this code ? /****************************************************************************************************************************...

best way to convert database table in codefirst to model

i have table of news , and i need convert to model . like this : i need pass to view NewsModel and i have table News . i convert that : public ActionResult EditNews(int NewsID) { ...

Attempt to access method 'WebMatrix.WebData.PreApplicationStartCode.OnConnectionOpened(System.Object, WebMatrix.Data.ConnectionEventArgs)' failed [on hold]

I've been trying to implement SimpleMembershipProvider authentication on a existing mvc project and the following error shows up Attempt by method 'WebMatrix.WebData.PreApplicationStartCode.Start()...

Fetching Office 365 mails MVC

i would like to fetch the mails of the current logged in user, they should be saved in my model Mail: if possible Mailbody, subject, to, from, and attachsments, timestamp. From what i have been ...

Can we update controller scaffolding after any change in model

I am using entity framework(schema first approach) to populate data and using scaffolding to perform create,edit,delete operations. whenever i add or delete any column in database's table I update ...

MVC.NET logic result different between localhost and production server

I have an condition check in the code. When this is running on localhost, everything is working fine. But when I compile it and deploy to web, the values all turns wrong. Anyone have any idea what is ...

MSSQL trigger value

Lets say my table has 2 value.after insert statement,how to i get the insert record data and insert it to the trigger?I am using entity framework for CRUD events. //orginalTable has 2 fields for ...
Translating... 0%