Questions tagged [asp.net-mvc-sitemap]

99345 questions
0

votes
1

answer
26

Views

How to call an implemented interface method with different return types? [duplicate]

This question already has an answer here: Does C# support return type covariance? 9 answers I've an interface that has one method with an Interface return type. Is there a way to implement that method in different classes with different return types (derived from the interface return type)? This is...
Phoenix_uy
-4

votes
0

answer
8

Views

how to prevent download file from websites [on hold]

I have try and searched lot of way to prevent the file download options from my web application .But i unable to do it .Anybody known , If is it possible please share the details to me.
somu
1

votes
1

answer
1.1k

Views

SingalR Error during negotiation request

I've got a project with SignalR and AspNet. I'm trying to connect my client (its a cors) and the first request returns 200 code but I'm getting this error in my client side: Error during negotiation request. My SignalR Server side classes: public class Startup1 { public void Configuration(IAppBuilde...
patricia
1

votes
1

answer
238

Views

Cannot Scaffold (EF, Core 2.1) model that contains a 'bool' item

My model looks like this: namespace Flow.Models { public abstract class Project { public int ID { get; set; } public String HashID { get; set; } public string FileLoc { get; set; } //Use HashedID above. public bool Network { get; set; } public int ClientID { get; set; } public int FirmID { get;...
user1489765
0

votes
0

answer
13

Views

How to bring another project (get,post) api method to swagger api project?

I've created one API project with asp.net core in which I used swashbuckle.AspNetCore dll to generate swagger. It is working perfectly and going well. Now I have another c#(.net standard library) in which I have created some GET, POST, DELETE, PUT method. Need to load all of those methods to the swa...
sk5202
1

votes
0

answer
10

Views

How to Fix “ The model item passed into the dictionary is of type but this dictionary requires a model item of type ”

I want to make paging in the table using Pagedlist and get an error The model item passed into the dictionary is of type 'PagedList.PagedList1[System.Collections.Generic.KeyValuePair2[MyProject.Data.Models.User,System.Collections.Generic.IEnumerable`1[MyProject.Data.Models.Role]]]', but this dictio...
chaeusang chen
1

votes
2

answer
670

Views

Which files to publish? ASP .Net Core 2.0

I'm working on hosting my first ever Asp.net core 2.0 website. To bundle the project I ran 'dotnet publish' This created the following folder structure for publish: /wwwroot /appsettings.Development.json /appsettings.json /ProjectName.deps.json /ProjectName.dll /ProjectName.pdb /ProjectName.PreCompi...
Richard Smith
1

votes
3

answer
2.4k

Views

dotnet build - get error “could not return the default page '/index.html'”

try to generate my project into exe file, but get error: before: 'dotnet build -r win10-x86' is ok after run generated exe, all is ok also: indows DPAPI to encrypt keys at rest. Hosting environment: Production Content root path: C:....\currencyColution\correncyProject\bin\Debug\netcoreapp2.1\win10-x...
Max990
1

votes
1

answer
173

Views

Where is the ClaimsIdentity information stored after calling AuthenticationManager.SignIn() using CookieAuthenticationProvider

We are using the Microsoft.Owin.Security.Cookies.CookieAuthenticationProvider in an ASP.Net MVC web application. The 'sign in' code uses a custom class that keeps track of authorization info (userRights in the example below). The code looks like this: string auth = JsonConvert.SerializeObject(userRi...
Louis Somers
1

votes
1

answer
223

Views

Override AccountController in Individual User Accounts

I've created in Asp .Net Core 2.1 - mvc Individual User Accounts and add scaffold identity. I need override route Identity/Account/Register to Account/Register. I guess I need access in AccountController and add attr [Route('')]. How can i do it?. In advance thanks for help.
nikita Abramov
1

votes
1

answer
50

Views

Dont serve requests before site is warmed up on Azure

Is it possible to have some kind of timeout to make sure site is warmed app after website is scaled out or instance was restarted in Azure? We are hosting Sitecore website on Azure Webapp and wouldn't like any requests to be handled by instance before its warmed up and instead served by other health...
Jack Spektor
1

votes
3

answer
29

Views

HTML `id` attribute conflicting with ASP.NET MVC `id` convention

Can someone please help me understand why this following code: @Html.ActionLink('Back', 'Index', new {id='backbtn'}) inside a View is rendering following HTML in the browser: Back instead of following desired HTML: Back Thanks in advance
R K
1

votes
2

answer
37

Views

Need to split a string and count occurrence

I have a string in my ViewData. I need to split it be COMMA and count the occurrence of words. i.e. ViewData['words'] = 'apple,orange,grape'. I need to split and get the answer as 3.
Ranjith Kumar K
1

votes
1

answer
51

Views

How to get value in textarea tag in c#?

I'm making a form for 'EDIT PRODUCTS INFORMATION' in which I'm retrieving data from the database. I have retrieved all the values except for the product's description which is displayed in textarea tag. The text-input tag works perfectly fine but textarea tag does not. Below is the code attached. St...
sara afzal
1

votes
2

answer
22

Views

How to re-select items in listbox?

I have a web page that has two listbox. I am having a problem with my jQuery/JavaScript. When the user selects an item in the left listbox, it should select three items in the right listbox. It only works the first time unless I refresh the page. I know the code is being executed because I can s...
PKonstant
1

votes
2

answer
179

Views

Does submit button passes its value to action method, on form submit?

Update: What are the control/fields whose value would be submitted when the form is post back? In an ASP.NET MVC Form, if user double clicks on the submit button, the form would be submitted two times. In order to solve this problem I implemented the solution explained here. This is my solution, wh...
Hooman Bahreini
1

votes
4

answer
60

Views

AJAX function is called first even before first line of jQuery button click, why?

I am working on MVC application where I have to hide button on button click and show when ajax request completed. But the button is hiding after all request is completed. Below is what I have tried. Below is the jQuery click even which has also ajax function calling on same button click. $('#btnCalc...
Suraj Kumar
1

votes
3

answer
38

Views

How to change the placeholder text if user selects an options

I currently have 2 option value in my asp form group where one represents country and the other is for the state/province. Is there any way to interchange the text? For example when user selects canada the placeholder text will be province where when U.S is selected the placeholder will be State. Ca...
Josh
1

votes
1

answer
51

Views

How we can implement a “Bell Notification” inside asp.net mvc-6 core

I am working on an asp.net core web application, and our system has a lot of functionality to assign items to registered users where i want to notify the users about these items, by implementing a Bell-like notification (which is been used by a lot of social media site), as follow:- now at this stag...
test test
1

votes
2

answer
38

Views

Problem with special characters from aspnet core to javascript

I am trying to pass an error message through the ModelState dictionary to be fed to a javascript code that generates an alert with that error. Everything works, but I can't get the special characters to appear correctly like ' ' ' and 'è'. Solutions? Code AspNet Core: ModelState.AddModelError('Uten...
Elmoro
1

votes
2

answer
2.5k

Views

Problem with MvcContrib

I want to use MvcContrib Grid helper, but i stuck on the problem - it's not working. I downloaded release for mvc 1, i have dll on my hard drive, i added a reference to my project, but i always getting following error: Error 1 'System.Web.Mvc.HtmlHelper' does not contain a definition for 'Grid'...
Alex
0

votes
0

answer
13

Views

HttpClient - An existing connection was forcibly closed by the remote host - IIS Published web app

I have tried a ton of solutions that I searched about this issue, but none of them fixed my web app. So, I have a web app that uses a vendor API to populate my data. I was able to successfully connect to the API and transact different kinds of API calls locally. After I completed my web app, I trie...
Lex
0

votes
0

answer
7

Views

How to customize views templates?

I'm trying to change the default T4 code of views in MVC5 views templates. what should I do? I have created a CodeTemplates folder and copied the default T4 files and changed them but nothing happened! This is the address where I picked the files 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\...
Arash Masir
0

votes
0

answer
3

Views

How to consume a web api with oauth2 authorization using ASP.net MVC?

I've been looking for ways of how to consume a web api with an oauth2 authorization using ASP.Net MVC. Any suggestions? I have already tried sending a request to the web api and recieve a response. But I'm having a hard time when it involves Oauth2 authorization because i don't know how to send head...
ikey
1

votes
3

answer
2.9k

Views

Json get 404 Not Found

In an asp.net mvc application I have a method that returns a JsonResult to the view. It works perfectly on my local machine, however when the application is deployed on the web hosting server, when I try get this data by hitting the view's link I get a 404 Not Found in Firebug. Is there anyone who k...
General_9
0

votes
0

answer
16

Views

html file input doesn't trigger on change event and disable file input control

I have a simple html form where I save product info and then refresh the screen with the saved product info. After that the user can upload a document. I have two questions here: Until user has saved the product info, the upload button should be not clickable. Once the product is saved and ID is gen...
Cindy
0

votes
0

answer
15

Views

How to post data to controller from ASP.NET MVC Form and Webgrid

I am new to ASP.NET MVC. I need some help for the following scenario. I have defined a model like this namespace Sample.Models { public class ContModel { [Display(Name = 'Name')] public string Name { get; set; } [Display(Name = 'Code')] public string Code { get; set; } [Display(Name = 'Customer')] p...
Niy
1

votes
2

answer
3.1k

Views

How to return an error if UserName Password does not match in MVC 4?

i am new to MVC, i want to create a simple Login Control. I have write the below code in controller: public ActionResult LoginControl(String UserName, String Password) { string result = ''; if (UserName == 'ram' && Password == 'ram123') { result = '1'; } if (result == '1') { return View('LoginContro...
Ram
1

votes
1

answer
2.6k

Views

Multiple Html.dropdownlistfor with the same selectlist, set selected value

I have a Add/Edit View with several dropdownlistfor, all is populated from the same selectlist. When i try to populate the view for editinng all dropdownlist have the same selected as the first one. Is there a way around this? I don't wanna use multiple selectlist because they all have the same cont...
TobiasW
0

votes
2

answer
25

Views

Need to pass text box values as parameters when calling controller method on button click

I'm working on an MVC form that's supposed to let the user enter some descriptions of their problem in various fields, and the text in those fields will then be compiled into an email and sent to us after the user clicks the 'Submit' button. I've got enough wired up to pass hardcoded strings as par...
R. D.
0

votes
0

answer
21

Views

Declare different name for query string attributes

Is there a way/builtin solution to map a query string property to a .NET property? For a Action and model: public ActionResult Index(AuthInitialRequest request) { return View(request); } public class AuthInitialRequest { [Required] public string FooBar { get; set; } ... } What i want to achieve is...
0

votes
0

answer
25

Views

How would one successfully return a BadRequest with an MVC Model?

My aim is to create a bad request response that passes an object with it. The reason for this is to create consistency with my return types. I have tried serializing as a JSON serialize but the response was not the same as sending the object. So if there is any way at all that this can be sent, it...
Paradigm
0

votes
0

answer
2

Views

Show Ping Status in list in MVC5

I am Using Asp.net mvc5, I have table with fields like 'id', and 'server_IP' populated with n-numbers of server ip. And wants to display the status of each IP ' success' or 'timeout' depending upon ping. I have used following; Ping myPing = new Ping(); PingReply reply = myPing.Send('8.8.8.8', 1000)...
sahaniarun
1

votes
4

answer
540

Views

TimeEntry Js function not working for Dynamically added textboxes

' + '' + '' + I am adding this textboxes on button click. On Document.ready i have written: $(document).ready(function () { $('.driveTimedaySlot').timeEntry({ show24Hours: true, showSeconds: true, defaultTime: '00:00:00' }); }); But it is not firing for dynamically added textboxes
Sagar K
1

votes
1

answer
4.3k

Views

CurrentPrincipal/User is empty in Web API service

I may be missing something obvious here. I'm new to both MVC and Web API, so I'm working on keeping my head above water. I have an MVC application that interfaces with a Web API service. Authentication will be handled by a login service developed internally. When working, the MVC client should ch...
Yoc
1

votes
2

answer
6.9k

Views

asp.net mvc Response.Redirect is not working in global.asax

I am trying to redirect to error page in global.asax file of asp.net mvc5 when any exception occurs in application. After executing Response.Redirect line nothing happening. It is not at all redirecting to errorpage which is available in the path ~\View\Shared\Error.cshtml protected void Application...
Govind
0

votes
1

answer
9

Views

New to SignalR, is there a way to broadcast to others WHILE a user is doing an action, not just when they start and finish?

So what I'm trying to do, and I've made a small example project here, is when a user is editing a cell in a table, the cell disables for everyone else on that page. All good. Here I set it up so that when the user enters a cell, it disables for everyone else, and on blur/exiting the cell, it clears....
James Verdune
1

votes
1

answer
3.3k

Views

How to upgrade mvc2 to mvc5?

I've got an old project from a friend that he wants me to do redo. How ever that project is written in ASP.net mvc2. So When I try to open it in visual studio 2013 I can errors. Saying the file is incompatible. How would I go ahead and fix this?
Joakim Carlsson
1

votes
3

answer
3.7k

Views

Delete File in SharePoint folder using C#

I am using SharePoint ExcelService to manipulate an excel file and then save it to the Shared Documents folder using ExcelService.SaveWorkbookCopy() Now I want to delete those files I saved earlier. What is the best way to achieve this using C# in a Asp.Net MVC Application? I tried it using the RES...
katho2404
1

votes
1

answer
383

Views

MVC 5 Unit tests vs integration tests

I'm currently working a MVC 5 project using Entity Framework 5 (I may switch to 6 soon). I use database first and MySQL with an existing database (with about 40 tables). This project started as a “proof of concept” and now my company decided to go with the software I'm developing. I am strugglin...
Pierre

View additional questions