Tagged articles - C#

Found 179 articles tagged with C#

Obtaining access token from Google+ API in non SPA web application
How to get access token in C# backend from Google+ API
0
Recently I was trying to use Google+ OAuth api for authenticating with Google+ and fetch some user basic info such as name and email. ...read more
Same page language switching in Umbraco
Land on the same page in different language in Umbraco using Relations
0
When we build multi-language website, we usually create two root elements which represent different language websites. To switch the language you just need to add a link to other root elements which represent other languages of the website. With this approach, when you switch language you will end up at homepage of the language regardless which page you were viewing. ...read more
Bypass SSL certificate validation
A workaround quick solution when your SSL certificate expires
0
It is a common thing that some of your application functionalities depend on an external HTTPS endpoint. However, renewal of SSL certificate for the external party is out of your control and you have to rely on the third party that certificate will be renewed on time...read more
Filesize to proper display string
Display size of file in the proper maner
0
How many times you had to display file size on your web page? Pretty much every time you might have the same issue with recalculating size to KB or MB. I caught myself doing this for so many times over and over, so finally I decided to write a piece of code for that. ...read more
The fastest way to export data to Excel
Export data to Excel in ASP.NET C#
0
It is not so rare that you have to provide some sort of export of your data stored in database. I have a feeling that clients really like to have that functionality, probably because they are more comfortable with Excel than with any other tool. First thing that might pop to your mind is to add a reference to Office library, but that would require that you have Office on the hosting machine which might not be the case as most of hosts do not have it. ...read more
Simple object mapper using reflection
Copy property values from one object to another using reflection
0
Dealing with models and POCO classes in MVC sometimes require to map properties from one object to another because they have some properties of the same name and type. This also can be a case when you are loading a model class from some other source and you need to transform it to your type with some additional properties, but also a bunch of properties with values from the source object instance. ...read more
Getting cropped image the smart way
The way to get cropped image URL with option to load original image too
0
I noticed that some of the content managers keep complaining about the quality and size of cropped images. If you lower down quality, file is smaller but in some cases it gets blurry with quirks which comes from compression applied to a file. Let's face it, image cropper is not Photoshop with all options for image optimization...read more
Check whether you are getting cached content in MVC website
The ways to check whether you are viewing cached or most recent content
0
It happens from time to time that you publish some content from back-end, but on the website you still see the old content. Reasons for this may be different: ...read more
Single file deployment concept in ASP.NET with WebAPI
Deployment contained in single file using WebAPI
0
As much as this sound new to you, it actually isn't. If you worked on any Windows From application in .NET you had an option to embedded files in your form like images, icons and even sounds and videos. This made deployment a lot easier because you only have to deploy one .exe file. ...read more
Optimizing LINQ expressions with anonymous types and methods
Advanced LINQ techniques
0
When LINQ was announced in .NET framework 3.5 I was a bit skeptic because it look a bit odd to me on the first look. Writing queries in C#, just did not look right to me. Anyway, not all the things introduced in .NET had long life...read more
Fastest way to return JSON result from a controller
Resturn JSON in MVC controller action
0
Recently I had to develop a form on a page which loads secondary dropdown list items based on selection in a primary dropdown list. Because secondary list items are basically children elements of the one selected in primary I just had to run through all children and just return text-value pair object to JavaScript to populate secondary dropdown list. ...read more
Nesting Dictionary items to create lists
Storing and reading nested Dictionary items as lists in Umbraco using API
0
Recently I wrote an article about workaround for storing lists in Umbraco. I did some googling and Umbraco API exploring since then I found another solution for lists in Umbraco. This solution is relying to Umbraco Dictionary...read more
Faking browser client in HttpWebRequest
Introduce your request to server as a browser request
0
Using HttpWebRequest to fetch some data in your code from web is the easiest way to do it. However some web locations have restrictions to all only requests which come from browsers. Performing a normal HttpWebRequest will return 403 status code (HTTP 403 - Wikipedia) which means forbidden access...read more
Dictionary lists in Umbraco
Out of the box solution for Dictionary lists in Umbraco
0
Umbraco implementation of localized values is based on Dictionary which is in settings section of Umbraco back-end. This works pretty fine in case you need to display only string values but does not work localized lists. For example you might want to have country list for your contact form on your website...read more
Using GoogleMaps Directions API to get accurate distance
Example of using GoogleMaps Directions API for calculating the distance
 
0
In situations where distance between two geo coordinates needs to be found most of the people are using mathematical function to do this. However there is a major disadvantage in using this method. ...read more

.NET

read more

JavaScript

read more

SQL/T-SQL

read more

Umbraco CMS

read more