tagged [asp.net]

MVC model boolean display yes or no

MVC model boolean display yes or no i have a boolean field in my model in mvc 4 entity framework 4.5 i want to display the field in my view i use this call but i got true or false, ### i want to get y...

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...

ReadOnly Attribute in MVC 4

ReadOnly Attribute in MVC 4 While the toot-tip says, ![enter image description here](https://i.stack.imgur.com/u9fq5.jpg) I tried using it but could not make it to work. I am not sure how it works and...

Is it possible to use async/await in MVC 4 AuthorizeAttribute?

Is it possible to use async/await in MVC 4 AuthorizeAttribute? The only override I see exposed on MVC's `AuthorizeAttribute` is `public override void OnAuthorization( AuthorizationContext filterContex...

Difference between Interface and Abstract class in terms of Decoupling?

Difference between Interface and Abstract class in terms of Decoupling? As we know there are basically two important difference between Interface and Abstract class. 1. We can have function definition...

Hyperlink to go back to previous page in asp .net

Hyperlink to go back to previous page in asp .net I have a page in asp .net `(http://localhost/error/pagenotfound).` There is a link in page, on clicking on which has to go back to previous page from ...

How to implement a "pure" ASP.NET Core Web API by using AddMvcCore()

How to implement a "pure" ASP.NET Core Web API by using AddMvcCore() I've seen a lot of ASP.NET Core Web API projects that use the default `AddMvc()` service without the realizing that using `AddMvcCo...

Is there any way to make base view component ASP.NET Core?

Is there any way to make base view component ASP.NET Core? In rc1 you can make BaseViewComponent and then inherit it and use it without any problems like baseController, but after migrating my project...

21 Jun at 19:12

How to set .NET Core in #if statement for compilation

How to set .NET Core in #if statement for compilation I created a multi-targeted framework project. I use something like this: But I can't find a wildcard for .NET Core. I tried: But it is not valid s...

ASP.NET Core web api action selection based on Accept header

ASP.NET Core web api action selection based on Accept header I want to return two different formatted responses for the same feature (a list of entities) based on the accept header of the request, it ...

Accessing Session object inside an Asp Core 2 View

Accessing Session object inside an Asp Core 2 View I want to show Session in view. Is that possible? I try with this in my view But i get an error > Severity Code Description Project File Line Supp...

ASP.NET MVC Global Variables

ASP.NET MVC Global Variables How do you declare global variables in ASP.NET MVC?

using mvc route constraints so a url can only be mapped to one of three possible params

using mvc route constraints so a url can only be mapped to one of three possible params Here is my route: I would like to add a constraint so the category can only match a null or one of three params ...

Get short claim type name

Get short claim type name I am using Asp.Net Core and ASP.NET Identity and when I get a Claim type I get something like How to get only the simple type name, e.g.: I know this is possible I just can't...

ASP.NET Bundles how to disable minification

ASP.NET Bundles how to disable minification I have `debug="true"` in both my , and I just don't want my bundles minified, but nothing I do seems to disable it. I've tried `enableoptimisations=false`, ...

Routes.AppendTrailingSlash exclude some routes

Routes.AppendTrailingSlash exclude some routes In MVC 5.2.2 I can set `Routes.AppendTrailingSlash` to true so that trailing slash are appended to urls. However I also have a robots controller which re...

How do I define a method in Razor?

How do I define a method in Razor? How do I define a method in Razor?

1 Mar at 20:23

How can I check if a user is in any one of a few different roles with MVC4 Simple membership?

How can I check if a user is in any one of a few different roles with MVC4 Simple membership? I understand that a good way to check if an user is in a role is: However How can I check if my user is in...

How can I code a Created-201 response using IHttpActionResult

How can I code a Created-201 response using IHttpActionResult How can I code a Created-201 response using `IHttpActionResult` ? `IHttpActionResult` has only these options - - - - - - - - What I am doi...

What is default session timeout in ASP.NET?

What is default session timeout in ASP.NET? What is the default session timeout value in ASP.NET?

16 May at 07:9

How to implement reCaptcha for ASP.NET MVC?

How to implement reCaptcha for ASP.NET MVC? How do I implement reCaptcha in ASP.NET MVC and C#?

7 Jan at 01:43

Execute code when starting an ASP.NET MVC 4 Application

Execute code when starting an ASP.NET MVC 4 Application I want when my application starts, to execute some code There is a folder `App_start` at the project, but I didn't find any file th

6 May at 10:44

Returning IHttpActionResult vs IEnumerable<Item> vs IQueryable<Item>

Returning IHttpActionResult vs IEnumerable vs IQueryable In ASP.NET Web API 2, what is the difference among the following? and

Difference between MVC 5 Project and Web Api Project

Difference between MVC 5 Project and Web Api Project I am new to and and trying to get the basics. AFAIK, we have project templates in VS 2013, named as `MVC`, `Web API` and `Both of them together`. I...

How to sign out other user in ASP.NET Core Identity

How to sign out other user in ASP.NET Core Identity How can i sign out another user (not the currently logged one) in ASP.NET Core Identity. I know there is a [SignOutAsync()](https://github.com/aspne...