Archivi categoria: MVC

POST Ajax and redirect file response to the browser

Yesterday a collegue of mine had a problem: How post an ajax form and redirect the file result to the browser. If you post a form to an handler that response with a file the result will be downloaded by … Continua a leggere

Pubblicato in .Net, Asp.Net, c#, MVC | Contrassegnato , , | Lascia un commento

Serializing Entity Framework classes with JSON (Web API) without relationship

How many times have you ever tried to serialize an object of a type generated by EntityFramework. As you know with Entity Framework the relationship between to tables are made using virtual IEnumerable. As just you try to access to … Continua a leggere

Pubblicato in .Net, Asp.Net, c#, Entity Framework, MVC | Contrassegnato , | Lascia un commento

MVC Remove error from MiodelState

If you do client side validation, you’ll know that hiding some controller will remove the validation for that controller. But if you need to validate it on server side, the validation will act also in some controller hidded by javascript. … Continua a leggere

Pubblicato in .Net, MVC | Contrassegnato , , | Lascia un commento

ASP.Net MVC client side validation with Bootstrap Select Picker

On my bootstrap template I use bootstrap select picker Using this plugin in DropDownList the validation client side not works. I found a great solution on stackoverflow and I report it here to share with you Add the class selectpicker … Continua a leggere

Pubblicato in jquery, MVC | Contrassegnato , , , | Lascia un commento

Inline if MVC Razor inside style or class attributes

There is no way to use inline if inside Razor,the only way is use Html.Row helper like this

Pubblicato in MVC | Contrassegnato , | Lascia un commento

No password Hasing MVC Identity 2.0

I know that all passwords must be hashed on a DB and I do it in all my personal projects; but unfortunately some times the customers ask me to have the clear users password. That’s why in some company the … Continua a leggere

Pubblicato in Asp.Net, MVC | Contrassegnato , , , | Lascia un commento

HttpContext GetOwinContext() outside Controller

In AccountController you can find this to access to UserManager If you need to access to ApplicationRoleManager, ApplicationSignInManager or ApplicationDbContext This is true if you write this code inside Controller because HttpContext is a property of Controller class: If you … Continua a leggere

Pubblicato in Asp.Net, MVC | Contrassegnato , , , , , | 1 commento

MVC Identity 2.0 Oracle ORA-12704: character set mismatch

By default when we create a MVC project the template will add in our web.config a connetion string to a SQL server file that will be created in app_data. If we want to work with Oracle database you need to … Continua a leggere

Pubblicato in MVC | Contrassegnato , , , , | Lascia un commento

MVC Configure to send verification email after registeration

MVC 5 could be configured to send verification mail, and I suggest it! To do this you need to configure the EMailService, there are many many example that use SendGrid but none if you wanna use your own smtp server. … Continua a leggere

Pubblicato in .Net, c#, MVC | Contrassegnato , , , | 3 commenti