Questions tagged as 'asp.net-mvc'

1
answer

TempData loses property when using Response.Redirect?

I have the following code in the pages that, to be accessed, you need to login: if (Session["Login"] == null) { TempData["msg"] = "É necessário realizar o login para acessar esta página!"; Response.Redirect("/Login/Index"); } This...
asked by 11.04.2017 / 13:05
1
answer

Correct way to update a Model from a ViewModel

I have the following question: Do I get a ViewModel in the Controller of ASP.NET. In the upgrade method I have two options: 1st option: transfer the ViewModel to the respective bank entity directly and update. 2nd option: Search firs...
asked by 17.06.2016 / 19:53
1
answer

Library that matches the interpolation string of C # 6.0 at runtime

Does anyone know of any library that does run-time interpolation in strings? I know it would be possible to do using Replace() , but I do not want to go through the list with all the variables. For example: Programa de classe {...
asked by 22.06.2016 / 15:25
2
answers

Encoding of special characters before going to the SQL database

I'm working with SQL Server 2008 and IIS7 to host my MVC website. For security reasons, the website on which I work at this time does not allow strings with special characters like '<' or '>' from <textarea> are se...
asked by 28.03.2017 / 16:54
2
answers

Search Filter

I have an entity of Items that relates to the table of products and it is already in production and is working perfectly! Now I need to create a search report where the user can determine through the filters the conditions of this query. The que...
asked by 25.05.2016 / 16:05
1
answer

How to check if the LINQ expression does not come null

I have this LINQ expression: MaterialImage mainImage = images.First(i => i.IsMainImage == true); My problem is that images.First (i => i.IsMainImage == true) can return null if it has no image with the IsMainImage property checked as...
asked by 04.01.2017 / 20:31
3
answers

Check two or more occurrences of list element (lambda / linq)

I have the following list<t> listCard; inside it I have the following values: [0]:7720890002560 [1]:7720890002560 [2]:7777777002560 [3]:7720890002560 [4]:7720444402560 [5]:7720777002560 [6]:7728888802560 [7]:7727777702560...
asked by 06.04.2017 / 20:55
2
answers

How to receive the view model in a GET request WebAPI?

Well, I have here a problem with my API and would like to ask for your help. I have a form here in Knockout JS, I do serialize from a constructor which in turn returns me a querystring so    API = Page = 1 & MinPrice = 185 & MaxPrice = 694...
asked by 16.03.2016 / 13:21
2
answers

Session C # how does it work?

What is the lifetime of a Session in ASP.NET MVC, and how do I find out how much time is remaining and how to add more Session time (if at all possible)? Is there another form of value guarding that is more performative?     
asked by 02.03.2016 / 19:10
1
answer

Web API - Token

An MVC application makes access to the WEB API services. To access the WEB API, a token is mandatory. In the WEB API application there is a button that generates the token. How to make the WEB API accept only the token generated throug...
asked by 21.03.2016 / 21:53