Questions tagged [asp.net-mvc-5.2]

Refers to the 5.2 version of the ASP.NET Model-View-Controller platform for web applications.

Refers to the 5.2 version of the ASP.NET Model-View-Controller platform for web applications.

479 questions
92
votes
6 answers

Error Invalid option '6' for /langversion; must be ISO-1, ISO-2, 3, 4, 5 or Default

I am trying to target .NET 4.6 and also take advantage of the latest C# version by changing the C# language version to 6. However during compilation I got this error: Error Invalid option '6' for /langversion; must be ISO-1, ISO-2, 3, 4, 5 or…
Rosdi Kasim
  • 24,267
  • 23
  • 130
  • 154
19
votes
4 answers

how to use enum with DescriptionAttribute in asp.net mvc

I am new to asp.net MVC. I am trying to use dropdown control on my view page, which populates from enum. I also want to add custom descriptions to dropdown values. I searched so many examples, but no one posted how to populated description on view…
Santosh_Sams
  • 207
  • 1
  • 2
  • 10
18
votes
2 answers

What is the latest ASP .NET MVC version?

I was trying to check the latest ASP MVC version, but I got really confused. I was able to understand the problem that happened first when Microsoft declared MVC 5 and then renamed it to MVC Core 1.0. Still I see now in Microsoft documentation for…
A Khudairy
  • 1,422
  • 1
  • 15
  • 26
17
votes
3 answers

How to get access token from httpcontext using owin and Mvc 5

I've got a IDP implemented in IdentityServer 4. My web app client(implemented in Mvc 5) authenticates with the IDP but now I need to get the access token from the request. A way to do that in .Net Core is to use the…
Txugo
  • 5,008
  • 5
  • 33
  • 40
15
votes
1 answer

Map all routes that start with a specific URL part / keyword

I'm building a test center for various unit tests on my personal library and I wanted to have an easy-to-access route for a test API. So I have two entries in my route config: the default and my custom route... routes.MapRoute( …
14
votes
3 answers

Asp.net Identity : User.Identity.GetUserId() is always null and User.Identity.IsAuthenticated is alway false

See my code below: var result = await SignInManager.PasswordSignInAsync(model.UserName, model.Password, model.RememberMe, shouldLockout: false); switch (result) { case SignInStatus.Success: string UserId = User.Identity.GetUserId(); …
user2376512
  • 885
  • 1
  • 10
  • 21
12
votes
1 answer

MVC 5 RadioButtonFor enum, the default enum value zero is always selected?

Say I have an enum: public enum OrderStatusType { Waiting = 0, Pending, Picked, Shipped, } I generated the radio button list as follows. @Html.RadioButtonFor(m => m.Status, OrderStatusType.Shipped, new {@checked =…
user4143172
11
votes
1 answer

Why does the DropDownListFor lose the multiple selection after Submit but the ListBoxFor doesn't?

I have read many articles about using MultiSelectList and have yet to understand what is going wrong with my DropDownListFor. I have a ListBoxFor with the same View, ViewModel and data that works fine. I want to use the DropDownListFor because of…
RJBreneman
  • 787
  • 7
  • 21
11
votes
3 answers

About Enum and DataAnnotation

I have this Enum (Notebook.cs): public enum Notebook : byte { [Display(Name = "Notebook HP")] NotebookHP, [Display(Name = "Notebook Dell")] NotebookDell } Also this property in my class (TIDepartment.cs): public Notebook Notebook {…
developer033
  • 24,267
  • 8
  • 82
  • 108
11
votes
2 answers

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 returns the content for the robots.txt. How can I prevent a Slash from being appended to the…
Boas Enkler
  • 12,264
  • 16
  • 69
  • 143
10
votes
2 answers

ASP.NET MVC 5.1 C# OWIN facebook authentication or login ask for birthday, likes, public profile, phone number

I have seen many posts for facebook authentication , either those are old or not working correctly as it should be. However finally I have made something in my project that works but not fully. Here is code where I ask for var…
Md. Alim Ul Karim
  • 2,401
  • 2
  • 27
  • 36
10
votes
2 answers

Razor Syntax gives errors in View before compiling (No intellisense)

I was going through the list of NuGet Packages and I was updating everything things like bootstrap, jQuery, etc. but while I was doing that, I unthinkingly updated Microsoft.Owin and another package (might have been EF or something else) and it was…
Termato
  • 1,556
  • 1
  • 16
  • 33
9
votes
5 answers

How to set 2 routes point to the same controller in ASP.NET MVC 5

I have an ASP.NET MVC 5 web site which has a controller MyFirstController. That way, I can load the index view by using https://example.server.com/MyFirst. On the other hand, I have another view that renders the link (HREF attribute of HTML A tag)…
jstuardo
  • 3,901
  • 14
  • 61
  • 136
9
votes
1 answer

Response.RedirectToRoute(RouteData.Values) redirects to the Area controller

I am trying to setup a BaseController to handle culture as part of the url (based on ASP.NET MVC 5 Internationalization). My implementation works properly as long as I disable my Areas' registration. When One of my Area is registered, if I try to…
Harmelyo
  • 141
  • 6
9
votes
3 answers

PerRequestLifetimeManager can only be used in the context of an HTTP request

I have a MVC application that uses Unity as its IoC container and have multiple services defined in my application using the PerRequestLifetimeManager. container.RegisterType(); Everything works fine, except when I tried…
SeToY
  • 5,777
  • 12
  • 54
  • 94
1
2 3
31 32