The simplest proxy wouldn’t need the proxy_set_header part but in my case I needed it because there was HTTP authentication in place. “ZGV2OmRldg==” is “username:password” Base64 encoded (without quotes).
Now, accessing localhost/api/ would be the same as accessing url.to.the.api/api/, which means that if you issue a GET request to localhost you are going to get one back from localhost instead of from across the internet – bye bye CORS!
Had to add an attachment functionality to the project I am currently working on at work.
The snippets below use a simple web service (which I didn’t include) that saves the files uploaded to a database and returns the columns read.
You need at least three columns in the table: ID (PK, int), FILENAME (varchar) and CONTENT (BLOB).
// Attach this method to an upload button.
private void UploadFile(object sender, RoutedEventArgs e)
OpenFileDialog fileDialog = new OpenFileDialog();
// In case you want filtering.
fileDialog.DefaultExt = ".txt";
fileDialog.Filter = "Text documents (.txt)|*.txt";
bool? result = fileDialog.ShowDialog();
if (result == true)
using (FileStream fs = new FileStream(fileDialog.FileName, FileMode.Open, FileAccess.Read))
Byte b = new Byte[fs.Length];
fs.Read(b, 0, b.Length);
// Save the byte array (b) to the BLOB column in the database.
// I am using a web service.
catch (Exception ex)
This presumes you want to create a transparent overlay layer over all of your elements and center a loading text to the middle of the application.
In my case I had a grid with three rows, hence the Grid.RowSpan="3".
If you change the Canvas name be sure to modify the ElementName in the DockPanel attributes.
Create a new ASP.NET Empty Web Application project inside your solution.
Right click on the newly created project and select Add > Web Service (ASMX) (or Add > New Item and find it).
Create the methods you need inside of it. Don’t forget to add [WebMethod] above the method you want to use.
When you are happy with it, right click the ASMX file and select View in Browser.
In the browser, select and copy the location to the WS (in my case http://localhost:65057/WebService.asmx).
Add a reference to the old project.
Right click on the old project and select Add > Service Reference.
Paste the URL you copied to the Address field and click on Go, you should see the WS and the methods you exposed.
Click on OK and you’re done.
Use the Web Service.
var ws = WebServiceSoapClient();
// WebService is the class name inside your WebService.asmx file.
Or, even better:
private WebServiceSoapClient _webServiceSoapClient;
if (_webServiceSoapClient == null)
_webServiceSoapClient = new WebServiceSoapClient();
var something = WebService.MethodName();
If you update your Web Service remember to right click on the Service Reference and select Update Service Reference (you might need to have the server running before by viewing the asmx file in your browser).
I was at Microsoft’s //publish/ event in Brežice this weekend, along with Vito and Nejc, trying to beat the competition with Vito’s application called Simplicy.
Simplicy is a simple music player (soon available for Windows 8 and Windows Phone 8), collecting music from around the net (featuring about 50 million songs) and giving users the possibility create their very own playlist with nothing but a few clicks.
You might be wondering what’s special here, right? Let me tell you.
The great thing about this application is that despite having a really simple interface there is no need to create an account or log in, to create or save your playlist. For free.
And what’s even cooler: it learns what music you like and shapes the results accordingly. You know how Windows Phone is “The Smartphone Reinvented Around You”? Simplicy is the same, but for music.
In just two days (with very little sleepy times) we managed to develop a beautiful cross-platform app and publish it to both Windows and Windows Phone stores.
And I’m really proud about the fact that we won (like bosses) in the cross-platform application category!
I can finally say what it is I do at my job: I am now one of the first Application Developers in the company I work for.
It’s nice to know where my place is and what I actually do, as until now I did whatever people threw my way (was always computer related stuff though, lately a lot of SharePoint hacking, writing functional specifications, performing tests on application updates etc).
This is also my first job as a developer. I think I’m a little scared as I never worked in a team of developers before, and always ran solo.
Let’s just hope I’ll be useful here. I’m sure I will learn a lot from the team and I’m definitely looking forward to it!
Sixteen steps that will definitely save you a lot of time if you’re working with workflows, especially the more complex ones.
Saved me a lot of trouble at work, I had to clone a list along with all of it’s workflows to another site.
Saving the list as template helped me move everything (including all of the custom made forms!), while the workaround below made it possible to simply import the workflows I had in place into the new list!