tagged [asp.net]

Adding style to Editor For

Adding style to Editor For I'm trying to apply a Style to the Editor for an element, but I can't make it work; what am I doing wrong?

How to add ASP.Net identity to Asp.Net Core when webApi template is selected?

How to add ASP.Net identity to Asp.Net Core when webApi template is selected? I have created a .NET Core project with WebApi template selected includes no authentication. I want to add ASP.NET identit...

How to reduce password reset token length in Asp.Net Identity?

How to reduce password reset token length in Asp.Net Identity? I am using Asp.Net Identity for generate a password reset token. above code is giving me a token with large length. Is it possible to gen...

Get image from wwwroot/images in ASP.Net Core

Get image from wwwroot/images in ASP.Net Core I have an image in wwwroot/img folder and want to use it in my server side code. How can I get the path to this image in code? The code is like this:

Redirect to login when unauthorized in ASP.NET Core

Redirect to login when unauthorized in ASP.NET Core In the previous ASP.NET MVC, there was an option to redirect to the login action, if the user was not authenticated. I need the same thing with ASP....

Is it possible to override the required attribute on a property in a model?

Is it possible to override the required attribute on a property in a model? I'm curious to find out if it is possible to override the [Required] attribute that has been set on a model. I'm sure there ...

Can anyone explain CreatedAtRoute() to me?

Can anyone explain CreatedAtRoute() to me? From the template for Web API 2, a post method is always like this: I don't understand this `CreatedAtRoute()` method. Can anyone explain it to me?

How to call function on timer ASP.NET MVC

How to call function on timer ASP.NET MVC I need to call function on timer (lets say onTickTack() function) and reload some info in ASP.NET MVC project. I know that there are several ways to do that, ...

Timeout a Web Api request?

Timeout a Web Api request? Like MVC WebApi runs on the asynchronous ASP.NET pipeline, meaning [execution timeout is unsupported](http://forums.asp.net/t/1963799.aspx?MVC%205%20Request%20Timeout). In M...

How do I check EntityValidationErrors when validation fails?

How do I check EntityValidationErrors when validation fails? I get this message when I try to edit a property in MVC 4 database first project. I'm using the MVC default edit page. > "Validation failed...

Return HTML from ASP.NET Web API

Return HTML from ASP.NET Web API How to return HTML from ASP.NET MVC Web API controller? I tried the code below but got compile error since Response.Write is not defined:

'HttpPostedFileBase' in Asp.Net Core 2.0

'HttpPostedFileBase' in Asp.Net Core 2.0 I'm recently working on a ReactJS app that's calling an API (developed with .NET Core 2.0). My question is how to use `HttpPostedFileBase` in an .NET Core 2.0 ...

Iterate through dynamic form object

Iterate through dynamic form object Using mvc i get values like this to avoid class declarations and router changes. I like to iterate through all values and check them for null or empty.

How to add Web API to an existing ASP.NET MVC (5) Web Application project?

How to add Web API to an existing ASP.NET MVC (5) Web Application project? Assuming you forgot to tick the Web API checkbox (add it to the project) when making a new MVC (5) project, what do you need ...

The operation could not be completed. invalid pointer - Visual Studio 2015 Update 3

The operation could not be completed. invalid pointer - Visual Studio 2015 Update 3 [](https://i.stack.imgur.com/HIEcu.jpg) Getting this error when opening `.cshtml` file: > The operation could not be...

HttpRuntime.AppDomainAppPath equivalent in ASP.NET Core

HttpRuntime.AppDomainAppPath equivalent in ASP.NET Core What is the equivalent of `HttpRuntime.AppDomainAppPath` in .NET Core? I moved a project from ASP.NET to core, and a few Libraries are not inclu...

11 May at 13:17

InvalidOperationException on File return

InvalidOperationException on File return am running into some weird issue when i try to return a file to be downloaded, so this is my code but the problem it return this error am not sure what i have ...

How to get current user, and how to use User class in MVC5?

How to get current user, and how to use User class in MVC5? - - `User``Items``Id``Item``User``List` I'm using "Individual User Accounts" from the MVC template. Tried these: - [How do I get the current...

Injection of IUrlHelper in ASP.NET Core

Injection of IUrlHelper in ASP.NET Core In , `IUrlHelper` could be injected in services (with `services.AddMvc()` in startup class) This doesn't work anymore in . Does anybody know how to do it in as ...

ASP.NET MVC Core WebAPI project not returning html

ASP.NET MVC Core WebAPI project not returning html Here is my controller i am sending my html ``` public class MyModuleController : Controller { // GET: api/values [HttpGet] pub...

Remove "api" prefix from Web API url

Remove "api" prefix from Web API url I've got an API controller By default it is mapped to URL `mysite/api/My/Method`, and I'd like it to have URL without "api" prefix: `mysite/My/Method` Setting cont...

How can i configure JSON format indents in ASP.NET Core Web API

How can i configure JSON format indents in ASP.NET Core Web API How can i configure ASP.NET Core Web Api controller to return pretty formatted json for `Development` enviroment only? By default it ret...

How to return JSON in an ApiController for a single method?

How to return JSON in an ApiController for a single method? Currently, my `ApiController`s are returning XML as a response, but for a single method, I want to return JSON. i.e. I can't make a global c...

ASP.NET MVC - Uploading an image to Amazon S3

ASP.NET MVC - Uploading an image to Amazon S3 I have my image from Request.Files[0]. Now, how do I upload this image to S3? I see that in the AWS .NET API you have to specify ContentBody when putting ...

Passing object in RedirectToAction

Passing object in RedirectToAction I want to pass object in RedirectToAction. This is my code: where searchJob is instance of SearchJob. But I don't get data on SearchJob action method. Instead I get ...

29 Sep at 13:14