Exemplo n.º 1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            var camoServerSettings = CamoServerSettings.GetDefault("TEST1234");
            var camoUrlHelper = new CamoUrlHelper(
                new CamoSignature(camoServerSettings.SharedKey), "/camo");

            app.UseCamoServer(
                "/camo",
                camoServerSettings,
                new HttpClient { Timeout = TimeSpan.FromSeconds(10) });

            app.Use(async (context, next) =>
            {
                if (context.Request.Path.Value == "/")
                {
                    await context.Response.WriteAsync(@"
                        <html>
                          <head><title>CamoDotNet example</title></head>
                          <body>
                            <img src=""" + camoUrlHelper.GenerateUrl("http://31.media.tumblr.com/265d44b9503782d921a6695eddb4d4ae/tumblr_inline_ntk5zmSKP21raprkq_500.gif") + @""" />
                          </body>
                        </html>");
                }
            });
        }
Exemplo n.º 2
0
        protected string GenerateSignedUrl(string url)
        {
            var helper = new CamoUrlHelper(new CamoSignature(
                CamoServerSettings.GetDefault(SharedKeyForTests).SharedKey), "");

            return helper.GenerateUrl(url);
        }