Friday, October 20, 2017

Web Service call from SharePoint Web Part - Forbidden

I ran into this issue recently and ,although in hindsight I feel like it should have been obvious, it might save someone else some time.

I was working on an AngularJS form in a SharePoint Content Editor Web Part and part of that required making a call to the API for a help desk application. I started off creating this in our Dev environment and I ended up not being able to call the API directly due to cross-domain calls not being allowed from JavaScript. Since I didn't have control over the API to configure CORS I created a web service in our domain that made the API call. Due to something in the way our network is configured I ended up having to enable CORS anyway but everything ended up working great in Dev.

After the users tested and approved everything I deployed to Prod. Of all the possible issues I could have, the one I didn't expect was for the web service call to fail. I didn't even have to change the url in the code. When I debugged I was getting a forbidden error. I double checked that I had CORS enabled since some time had passed. I was also looking into whether something in the network might be causing the issue because, while our Dev environment is in house, the Prod environment is hosted elsewhere. One thing I found strange was the in trying to view the call in Fiddler, I couldn't even see it. Trying again in Dev Fiddle did pick up the call.

After pulling out my hair for a while I finally realized that Prod uses a secure connection while Dev doesn't and the web server that was hosting the web service was also not secure. I asked our server guy if he could install an ssl cert on the web server and after he did that and I updated the url in my code everything worked perfectly.

The thing that made this take longer to figure out was that I thought from the error that I was getting a 403 Forbidden from the web server but it was the browser preventing me from making a call to an unsecured web service and that is why Fiddler didn't show the call because there was no call. I just wish the error had been clearer, it would have saved me a lot of time.

-Z

Sunday, May 8, 2011

Windows Server - Shutdown Event Tracker

Anyone who has used a Windows Server OS for their workstation, in a VM or on a development server has probably been annoyed by the Shutdown Event Tracker (that prompt that asks you to enter a note about why you are shutting down) when restarting or shutting down. If you have ever wanted to get rid of that than here are some instructions.
  1. Open the Local Group Policy Editor by running gpedit.msc
  2. Under Computer Configuration select Administrative Templates and Click System
  3. In the right window double-click Display Shutdown Event Tracker
  4. Change the setting to Disabled and click OK
That's it.

-Z

More on GNOME 3

Just a note on a few things I have noticed with GNOME 3.

First - No desktop icons. That is going to take a little getting used to. I don't use them all that much anyway but I still like to have them there for commonly used files and applications. But now that there is the favorites bar on the left, that pretty much takes care of the desk top application links and I really should be keep my documents and things in the proper location anyway so its no big deal.

Second - Search. When you bring the mouse to the upper left corner or click activities, in addition to getting the favorites bar on the left, desktops on the right and open windows or applications in the center you also get a search bar that will narrow the list of applications to what you enter. So, for instance, I type Blue and I get Blue Fish Editor and Bluetooth settings. It also has the option to search Google or Wikipedia for the search string you typed. 

Third - Minimize and Restore icons. The normal options of close, minimize and restore are replaced with just a close icon, although Chrome still has all 3. This is a little awkward but you can right click on the title bar to use these functions. 

Finally - IM. When you receive an instant message you get a notification with the message in the lower center that doesn't interfere with what you are doing. Hover your mouse over and it opens up with a place to type a reply so you can IM with someone while doing other things without switching back and forth between windows.

Overall I like the new UI but I guess like anything that is new, you aren't going to love everything about it.

-Z

Saturday, May 7, 2011

Intellisense in SQL Server 2008 R2

Well since I complained about something stupid in SQL Server 2008 R2 the other day, I think I should say something good. Having come from SQL Server 2005, I have to say I am loving that Microsoft added intellisense to SQL Server 2008. Its one of those features that I always wished was there because its so easy to mistype something, especially when creating stored procedures, so the fact that tables and field names, parameters, etc pop up as you type makes life much easier.

-Z

Bare Metal Restore

I got 2 new SSD drives this week at work for my laptop. They are replacing 2 regular drives of the same size. Unfortunately the old drives were setup in a RAID 0 configuration so to the OS (Windows Server 2008 R2) they read as a single 320 GB drive. I had less than half the space used up so I thought I could do a Bare Metal Restore backup and restore it to one of the new drives. The backup went fine but when I went to restore I kept getting the error:  "The system image restore failed. No disk that can be used for recovering the system disk can be found."  Not a very helpful message, it gave some additional information about checking for excluded disks and some suggestions if you were restoring to a USB disk none of which applied.

I assumed the problem had to do with the RAID configuration or something with the size of the backup. After some research it turned out that you can not do a Bare Metal Restore from a larger disk to a smaller one even if the size of the data to restore would fit on the new disk. So now I had to figure out how to manage that. I went to Server Manager and tried to Shrink the C Drive but due to fragmentation of the drive it could not shrink it enough. I ran disk defragmenter and tried to shrink the drive again but it still would not shrink it enough. Then I remembered a tool I had used when converting my home laptop from a windows machine to dual booting windows and linux, Perfect Disk. It had been able to move files that the windows defragmenter couldn't so I gave it a try and sure enough, it came to the rescue again and completely defragmented the drive and I was able to shrink it enough, do another backup and restore it to  one of the new drives and everything is working great with the new SSDs.

-Z

GNOME 3

Well I gave up on the Unity UI for Ubuntu 11.04, I just didn't like it. I installed GNOME 3 using these instructions with a few changes. First instead of using the Run Application dialog I just opened a terminal window and ran all the commands in there. Also, before I could get sudo apt-get install gnome-shell to run I had to do sudo apt-get -f install. After that it worked fine.

So far I like it a lot better. Although there are some similarities, GNOME 3 is a lot more intuitive than Unity and even after using it for just a few minutes I could find everything and get around pretty easily which wasn't the case with Unity.

I'm not sure I like it better than GNOME 2 yet but as I play around with it I will see how I like it.

-Z

Friday, April 29, 2011

Why does Microsoft have to change things?

This is kind of a pointless post but I was doing something in SQL Server 2008 R2 today and I wanted to quickly view the contents of a table so I went to do the old stand-by from SQL Server 2005 of right-clicking on the table name and selecting Open Table but it wasn't there. I looked at the options and decided to try one that looked like it might be similar, "Edit Top 200 Rows". Seems to be exactly the same as Open Table. I just don't get why they had to change that, especially since I more often use that feature to just do a quick look at the data in the table than to actually edit the data so I think the old label made more sense.


Anyway, that's it, just complaining.


-Z