Archivi categoria: Asp.Net

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

Visual Studio 2015 Publish a website without roslyn folder

I published a Web Site using the new Visual Studio 2015 Looking the published folder I found a folder named roslyn inside bin folder. This happens deploying in File System. If you have to copy the deployed folder to an … Continua a leggere

Pubblicato in Asp.Net | Contrassegnato , , , | 1 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

Region in css

Region are a great features working with source code. Is there a way to use region in css? YES! It’s a visual studio trick, you have to put this commented in css/less code. like this:

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

REST web method and AJAX call in ASP.NET page

In this post I don’t speak about new features but an old one. I decided to speak about it because I notice that with all the new method to create a service the old WebMethod have been forgotten. In .Net … Continua a leggere

Pubblicato in .Net, Asp.Net, c#, javascript, jquery | Contrassegnato , , , , , | 1 commento

Asp.Net SiteMapPath parent page parameter in querystring or change title

I notice now that I haven’t ever talk about SiteMapPath. First of all SiteMapPath is a asp.net control very easy to use to obtain breadcrumb navigation. What we need? With Visual Studio add new “Site Map” (.sitemap) file to the … Continua a leggere

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

JSON Serialization C#

Today I write DAL layer that comunicate with the service with JSON. First of all I used JavaScriptSerializer object but I found some problem with DateTime type. When it deserialize the DateTime it consider the UTC delta and day light … Continua a leggere

Pubblicato in Asp.Net, c# | Contrassegnato , , , , , , , | 1 commento

Add javascript or css to tr created by asp.net GridView

I don’t like too much use GridView controls but in a existing project I found it applyed. My target was only to attach “onclick” javascript event to the row generated. Inside this event it’s possibile access to the item’s column … Continua a leggere

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