Archive

Archive for October, 2015

Pkpass api (Apple passbook)

October 20, 2015 Leave a comment

Just a quick post, but I’ve just launched this website Pkpassapi.com for creating Apple wallet / passbook coupons (pre signed) 

Enjoy!

Advertisements
Categories: Uncategorized

LoadCertFromFile exception IIS when loading p12 cert. #x509

October 9, 2015 Leave a comment

This is a nasty little error that I solved this morning.

I was trying to load a .p12 cert from disk, which worked fine on my local pc, but as soon as I installed it on the server, I got this error “_LoadCertFromFile” – So, I tried importing the certificate manually using certutil, – resetting IIS, but eventually, discovered a fix on stackoverflow, where you have to enable “Load user profile” under advanced application pool settings


Here was the full error for reference:

Server Error in ‘/’ Application.

An internal error occurred.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Security.Cryptography.CryptographicException: An internal error occurred.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[CryptographicException: An internal error occurred.
]
System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr) +41
System.Security.Cryptography.X509Certificates.X509Utils._LoadCertFromFile(String fileName, IntPtr password, UInt32 dwFlags, Boolean persistKeySet, SafeCertContextHandle& pCertCtx) +0
System.Security.Cryptography.X509Certificates.X509Certificate.LoadCertificateFromFile(String fileName, Object password, X509KeyStorageFlags keyStorageFlags) +307
System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(String fileName, String password) +84
libPkPass.PkPassGenerator.GeneratePkPass(Pass details, String assetsFolder, String p12File, String p12Password) in c:\projects\troop\Troops\PKPASS\libPkPass\pkPassGenerator.cs:105
libPkPass.PkPassGenerator.GeneratePkPass(Pass details, Uri logo, String colour) in c:\projects\troop\Troops\PKPASS\libPkPass\pkPassGenerator.cs:40
TroopAdminMVC.Controllers.ApiController.GeneratePkPass() in c:\projects\troop\Troops\TroopAdminMVC\Controllers\ApiController.cs:161
lambda_method(Closure , ControllerBase , Object[] ) +79
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +242
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +39
System.Web.Mvc.Async.AsyncControllerActionInvoker.b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +12
System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +139
System.Web.Mvc.Async.AsyncInvocationWithFilters.b__3d() +112
System.Web.Mvc.Async.<>c__DisplayClass46.b__3f() +452
System.Web.Mvc.Async.<>c__DisplayClass33.b__32(IAsyncResult asyncResult) +15
System.Web.Mvc.Async.<>c__DisplayClass2b.b__1c() +37
System.Web.Mvc.Async.<>c__DisplayClass21.b__1e(IAsyncResult asyncResult) +241
System.Web.Mvc.Controller.b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +29
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +111
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +74
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +19
System.Web.Mvc.MvcHandler.b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +51
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +111
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +606
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34249

Categories: Uncategorized

Application-wide page transitions using App.Xaml #Wp8

October 8, 2015 Leave a comment

By default., if you call  NavigationService.Navigate within a windows phone app, you get an instant transition, which is fine in most applications, but it adds a bit of pizzazz if you can have the page flip over like the transition you see when you open an app from the home screen.

Most tutorials online detail a method to do this by modifying each xaml page of your application, that’s fine in a small project, but what happens if you have lots of pages?, lots of code copy-paste?

Here’s a method of implementing the page transitions app-wide, by modifying App.Xaml.cs

First, in InitializePhoneApplication . define RootFrame as follows

RootFrame = new TransitionFrame();

Then in CompleteInitializePhoneApplication, comment out the line

// RootFrame.Navigated -= CompleteInitializePhoneApplication;

  • Which will cause this event to fire every time a page loads.

Then add the code

PhoneApplicationPage page = RootFrame.Content as PhoneApplicationPage;
NavigationInTransition navigationInTransition = new NavigationInTransition
{
Backward = new TurnstileTransition { Mode = TurnstileTransitionMode.BackwardIn },
Forward = new TurnstileTransition { Mode = TurnstileTransitionMode.ForwardIn }
};
NavigationOutTransition navigationOutTransition = new NavigationOutTransition()
{
Backward = new TurnstileTransition { Mode = TurnstileTransitionMode.BackwardOut },
Forward = new TurnstileTransition { Mode = TurnstileTransitionMode.ForwardOut }
};
TransitionService.SetNavigationInTransition(page, navigationInTransition);
TransitionService.SetNavigationOutTransition(page, navigationOutTransition);

Other transitions you can play with are;

RotateTransition
SlideTransition
SwivelTransition
TurnstileTransition

Categories: Uncategorized