Category Archives: Microsoft

Adding .JS file generated by TypeScript in Visual Studio 2013 to markup

Note to self :

If you want to add .js file generated by TypeScript from .ts file under Visual Studio 2013, you don’t need to click Show All Files, than search for file you wanted to add and then disable Show All Files (because by default, .js and map files are not part of project). You can just drag and drop .ts file to .html or .aspx markup and Visual Studio 2013 is intelligent enough to include .js file. Fast, simple, obvious. Not for all however :) .

How to convince Internet Explorer to show more pages with untrusted cerificates in one tab (iframed)

Funny article name you say and I can only agree, yes :) most of the time you run like hell when you see page with broken certificate. But I will explain why one might need this :)

My girlfriend is a tester and at her current work she is testing web apps. Since majority of these apps use SSL and she is using staging versions, she has to accept certificate errors and if you know what you are doing, than everything is OK and fine (you see errors because of self signed certificates).

Yes there are more ways how to get over this problem :

but if you don’t want to do this/you cant do this on your box then you just have to live with basic temporary exception and you will click Continue to this website :

ie certificate error

And now comes the problem part/our edge case. Most of the time you are accessing one URL on one server and everything works.

But lets say you have your testing URL with self signed certificate where is a page with IFRAME to different URL with different certificate on different server. Now what? You have to add two different exceptions.

The problem lies in how IE (tested in IE11) displays another page. You just don’t have any option how to add another exception, you just see that the iframed page has invalid certificate, nothing more…

The FireFox solution :

The FireFox way is more common and most of people know it (so just small recap):

you can open new tab with IFRAMEd URL, access it, see error and add permission. Than on another tab access hosting page, add second exception and you are done, all of the later visits to hosting page share the same exception. Which is nice, because you can close the tab and open different one later and you don’t need to add exception to IFRAMEd URL over and over again.

The IE (I suppose because of the architecture – more on this here – ) behaves little bit differently.

The IE solution :

In IE the exception for IFRAMEd page isn’t shared between tabs/shared for whole browser instance so you have to :

  1. Access the IFRAMED URL and add exception and then on the very same tab
  2. Access the hoster URL and add second exception

and everything should work now also for IE the way expected :) but once you close the tab with exceptions, you have to do the same thing again…

Decision which way is better/safer is up to you….

Hope this helps :) Tested on latest versions of Windows 7 + IE11.

JavaScript Visual Studio snippet for is object defined check

Since I write a lot of JavaScript currently in Visual Studio these days, I lack one of the very common checks in JavaScript and that is testing if object exists.

I mean this check :

if (typeof (someObject) !== 'undefined') {



If you want to use this code but not type it each time over and over again and speed your work up you probably thought a snippet that would save your keystrokes would come handy, but there is none in vanilla VS. So, you can use my snippet ,just import it to Visual Studio from Code Snippet Manager window (in VS 2013 – CTRL + K + B) and use it with typing def and then tab (or use CTRL + K + X and pick one).

Enjoy your speedup while working with JavaScript.

PS : do you know you can share snippets with your team mates?

PS2: If you want to edit snippets in you VS, this plugin might be a good idea :

How to drop VS2013 Browser Link requests from you Fiddler debugging session – filter for specified host name and port

The short story:

Filter out only hosts and ports you need. Apply the filter, enjoy.

Complete story with more help:

Visual Studio 2013 gave us awesome thing, Browser Link – , but essentially, what is happening is, it’s using SignalR to inject some JS to let VS 2013 communicate with browsers. So it can happen, that you are debugging something on the localhost and suddenly you see something like this :

browser link

How to filter this noise away? First thing I was using process filter :

fiddler process filter

but this will only filter out process, so you will see only IE (in this case, or anything you choose), but how about filtering only domain? It’s in another place, but it’s there, just hidden a bit :

fiddler filters

Here you can filter more, than you need to click on the Actions button and Run Filterset now, this will apply filters to what you already have + all future events.

And the last part of puzzle is, you need to filter for (this applies only for me in this particular case), localhost:80 , because to filter only for localhost would yield also all requests to all localhost ports, what we dont need.

Another option could also be to : ban particular host:port , depends on your needs :)

Hope this helps,


Internet Explorer 11 isn’t displaying all .htc files in JavaScript debugger part

Since I upgraded my Windows 7 developer box with Internet Explorer 11 I am very satisfied with how Microsoft upgraded developer tools. They have added new stuff and it works (well from time to time IE freezes but that might be also my problem with my JavaScript since other browsers hang/crash from time to time on my code also). But that is another story.

Today I came across small “feature” that took me few minutes to realize, what is happening.

I am using IE 11 to debug older ASP.NET WebForms app (with older I mean we are just now moving away from HTC files – Microsoft specific stuff).

IE is loading page from my local IIS with x-ua-compatible flag like described on the link provided, setting rendering core to use version 8 so behaving like IE8.

Loading my page like this results to loading just some .htc files referenced. If I set breakpoint to some code in .htc file, it will be not hit, even some objects are declared as undefined but strangely executing any method over these yields results and works as expected (so I suppose the JS core works as it should , it’s just matter of developer tools).

Quick fix to this is : just reload the page, then all files will be loaded and you can happily work as expected.

Small sample how it looks like in IE developer tools (the very same page, just loaded 2 times) :

First load:

ie11 developer tools load error

Second load:

ie11 developer tools load OK

Just in the case, version of my IE 11 :

my ie11 version

Hope this helps someone, enjoy.

PowerShell Tools for Visual Studio 2012 problem – .ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies

Solution to your problem :

For some reason,  account on which you run VS on and on which VS hosts PowerShell has restricted ExecutionPolicy (you can type Get-ExecutionPolicy , select the text and hit CTRL+F8 and should see Restricted as the answer).

So the solution is simple (should be): override the settings and set it to RemoteSigned with this command :

Set-ExecutionPolicy RemoteSigned

select the text, hit CTRL+F8. Now hitting F5 should make your PS behave.

(Alternatively Unrestricted is also viable option, but this is considered unsafe. More on this here :

More on the topic :

I wanted to create some PowerShell script and I thought there has to be something better than PowerShell ISE (sry, I am just too used to VS and debugger and all that goodness I have at my disposal) so I discovered this wonderful plugin for VS 2012 – PowerShell Tools for Visual Studio – and all worked as expected, until (as far as I remember) I restarted OS and had this strange error in VS in my output window :

Error: File C:\users\your_name\documents\visual studio 2012\Projects\PowerShell Script Project1\PowerShell Script Project1\Script.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at

The program ‘PowerShell Script’ has exited with code 0 (0x0)
(Small side note here to make you more puzzled but this might also help you in some way : I work in a company where admins takes security seriously and our “normal” day to day accounts are restricted and don’t have access to this and that so we have another accounts to install sw, make changes to the system, etc. I need to run my VS under this account, not my own.)
Great, no what? There is a link to documentation about what execution policies are and how to set them, etc, I changed it from vanilla restricted state to RemoteSigned and the very same .ps1 file worked after I set RemoteSigned for my and my admin account. It looks like PS stores policies per user in registry. More on this here :


Than I had “brilliant” idea to try PowerShell commands in NuGet Package Manager Console because it is using PowerShell under the hood, I was just looking for some prompt to query the ExecutionPolicy. And the magic happened, after query the PowerShell worked!!!! Brilliant but this is just workaround and not the solution.


After this the best idea seemed to contact the author so I mailed directly Adam Driscoll (apologies for distraction) which led to few discoveries like :
  • Writing some text in the .ps1 file in VS and selecting some code and right click reveals Execute selection option that is able to run your code event if it fails running it F5,
  • Adam downloaded in his spare time NuGet sources and it looks like : “NuGet sets the process scoped execution policy to RemoteSigned when it is initialized. “

So next logical step would be to try to run Set-ExecutionPolicy from VS to set it for account that VS is using to run PowerShell. And it looks like it is working.

Enjoy guys and thanks Adam for your plugin and your time.

How to split string in PowerShell with multiple delimiters

Hello world.

I just wanted to share with you one simple stupid snippet (please note, I am PowerShell newbie so have mercy and if there is any better way, please share in comments, thank you).

Because in my current work we need to parse and update some .aspx files (I will try to publish this later on my github),  I am fiddling a bit with PowerShell and Regex and such stuff.

I wanted to split a row in processed .aspx file and I wanted to use multiple delimiters while splitting. But according to this :

you can’t use multiple delimiters as parameter, like say array of delimiters like I was used to in C# :

OK so without any further  ado :

you can chain .Split in PowerShell like this :

$splittedRow = "<tag id='abcd' id2="efgh"></tag>".Split("""").Split("'")
Write-Host $splittedRow

This will return string splitted with delimiter ” and ‘.


Unable to attach to the process. A debugger is already attached. – Unable to attach to IIS problem in Visual Studio.

So I came across this sweet little problem that I wasn’t able to attach to IIS 7.5 from my VS 2012 on Windows 7 and I want to share the solution with you.

I am taking part on development of larger ASP.NET WebForms 4.5 application and we are using local SQL server + local IIS 7.5 on Windows 7. From some point in time, I wasn’t able to attach to IIS w3wp.exe process.  Every other process I was able to attach however and I was puzzled. The note I had from VS 2012 was looking like this :unable to attach to the process IIS vs 2012

The problem was, that I wasn’t for some time creating any server side code (I was playing on the client) and I installed some tools and programs that might changed something. Another problem was, that I could inspect the w3wp.exe in say Process Explorer but I wasn’t able to find any tool that would tell me : what process in attached to some particular process of my interest (if you know any tool that can do this, please share, thank you). I googled and binged but most of the problems I found were about Developer Tools in IE attached to IE itself and nothing that could help me.

Today I had some time to fiddle around and the solution is simple :

I was playing with this tool from Microsoft : Debug Diagnostic Tool 1.2 which is able  (if you create a rule for that) to listen to IIS and collect exceptions. I created a rule some time ago and I forgot to deactivate it. So everytime IIS started, it attached and collected the data. I told DDT to do so. And I was second in a row. If you deactivate the running/attached rule, VS will be able to attach again.

Just don’t forget to do so.

debug diagnostic tool deactivate rule

Hope this will save you some time. :) Enjoy.

IE10 developer tools – web page is not responding

I just came across nice thing with Internet Explorer 10 on Windows 7.

I was debugging JS on my dev box and I experienced problem like this :

ie10 localhost not responding

At first it seems like development tools freezed. Also IE as such freezed. What I saw was IE with page in the back and tools with note you see above. I clicked on IE icon in taskbar and saw two “windows” like this.

ie10 two debugging taskbar

In fact what happened and I didn’t realized that was :

  • I started IE,
  • I opened development tools – tools are attaching to IE and listening to events = we are debugging,
  • some JS error happened,
  • I clicked on “Do you want to debug this web page?”,

ie10 js error

  • IE opened another development tools and now we have 2 development tools windows opened like this :

ie10 two debugging windows open

Problem is, that you see only 2 windows opened under IE icon, the reality is that you have IE and 2 development tools windows. 1 is live and working, 2 is blocked by newly opened one and might be hidden behind one of these two. So beware of this fact. IE works well, but this behaviour is not expected, at least by me.

Hopefully this will save you some time. Enjoy.

AD: I found one more thing. If IE while debugging misbehaves and shows you blablabla page is not responding – same as in first picture – just hit Win key + D = shortcut to display desktop and bring IE up again and it should work :)

Microsoft TechDays Žilina 2013

Včera som sa zúčastnil TechDays v Žiline a preto malý krátky článoček o + / – a pár fotos. Všetky názory sú moje vlastné, hodnotím akciu z môjho uhla pohľadu ako developera, prosím berte ich len ako fakty na Žilinskej edícii. Osobne som sa zúčastnil Dev tracku a potom šiel na Azure camp, môžem teda hovoriť len o tom čo som videl tam.

V prvom rade, ak robíte s MS technológiami, alebo sa o ne zaujímate, je to viac/menej povinná jazda. Uvidíte ľudí stojacich za, ľudí priamo z MS ktorí Vám pomôžu/nasmerujú ak treba a prípadne nejaký ten networking s ľudmi z fachu alebo peknými študentkami, človek nikdy nevie :) Každopádne je to komerčná akcia, nieje to akcia ala Barcamp. Ale to asi nik ani neočakáva.

Každopádne by som odporúčal KAŽDÉMU zamestnávateľovi ktorí to myslí vážne so svojím IT/dev/devops oddelením aby napakoval developerom auto jedlom a kávou, dal im kľúče a o deň posunul deadlines a TRVAL na tom, aby tam šli (v prípade potreby použiť aj vyhrážky), investícia do ľudí je vždy dobrá investícia (a občas im kúpte aj nejakú tú knihu, myslím o developmente, nie 50 shades of gray či čo to je).

Takže + :

  • Prezentátori prídu bližšie k Vám, ak nieste z BA,
  • Ľudia priamo zo SK alebo CZ MS,
  • MVPs alebo exMVPs ktorí poradia/pomôžu (alebo na nich dostanete kontakt, môžete diskutovať mailom),
  • Tracky pre developerov, ITpros, dizajnérov, a pod., každý si vyberie,
  • Zaujímavé témy pre široké spektrum ľudí pohybujúcich sa okolo IT,
  • Je veľmi príjemné vidieť ako vaša alma mater prosperuje a že sa jej darí a po dlhšom čase včera zo Žiliny a z fotos z KE som mal ten wow pocit, tie priestory sú už dosť dôstojné, nemusíme sa za ne hanbiť, máme kde prezentovať študentom a je tam všetko vybavenie ktoré na to treba (ak ehm funguje, viď nižšie…).
  • Zaujímavé témy pre mňa ako developera, w8, azure, EF5 a pod,
  • Na campoch sa rozdávali “darčeky” ako knihy a pod. veci, čo je super podpora pre developerov IMHO

Nejaké tie – (alebo povedzme fakty ktoré by mohli byť aj lepšie/iné) :

  • Tento rok nebol žiadny termín v Banskej Bystrici a viem minimálne o 2 ľudoch ktorí nešli len pre tento dôvod (ja som vám vravel Michal a Tomáš poďte, budú ženy… ale nie…),
  • Nebola žiadna pauza na obed, len pauzy pomedzi prednášky (ovocie, káva a bagety to istili), osobne by som asi posunul začiatok a nechal nejakú pauzu,
  • Trochu ma prekvapilo že na Azure campe bolo menej ľudí ako som osobne čakal, téma bola zaujímavá, aj speakri (vlko, slavo furman, miro kubovčík), dôvod teda netuším,
  • Dostal sa mi do ruky Microsoft Surface of Spigiho, no nedostal sa zvyšku, myslím že developeri by to ocenili (nebol som ale na Windows 8 campe, len na dev tracku),
  • Asi 2x nám vypadla elektrina, nie vždy fungovali mikrofóny a pod. drobnosti, nebola napr ani free wifi, čo nieje tragédia ale keby som bol z CZ alebo PL tak isto neplatím dátový roaming na 1 deň, načo (toto je pekne riešené free wifi napr na Barcape vo Vsetíne a je to super, ale pre úplnosť hore na Azure campe sme mali papier s name/pwd do wifi no bola asi skôr pre prezentujúcich, každopádne ja som nikde nevidel wifi pre návštevníkov),
  • Chcelo by to niečo intenzívnejšie, možno aj nejaké hands on laby KEBY bol čas na campoch, možno by to chcelo ďalší extra deň pre laby, teda 2 dňovú akciu. Chcelo by to proste prebrať viac tém v rámci campov, lenže za 4h sa nejak extra “svietiť” nedá, škoda.

Takže snáď som na nič nezabudol, pokochajte sa ešte extra kvalitnou galériou môjho mobilu a na budúci rok príďte.