Passing previously retrieved value into webclient head via wizard - mobile

I would like to pass a session token retrieved initially by a REST GET via web client into the following Webclient REST Actions as a header parameter can this be done through the wizard?
Is there a way to do this in smartface app studio? Any logical idea?

You cannot do this. Because you have used WebClient wizard, it generates/configures your WebClient automatically. I can recommend you 2 methods to do this action:
Create your WebClient dynamically and go configure it freely/anytime.
Create a new WebClient via Wizard and configure it after receiving the token.

Related

operation name appended to Backend service UrL in azure API management

I have a logic app with http trigger. I am trying to create a proxy for the logic app using APi management. The issue I am facing is that APi management when calling the Logic App, adds operation name which makes the logic app url invalid.
Example: logic app url: azure/invoke
API manager operation name: pass
Looking at trace logs, URL to call Logic app is:
azure/invoke/pass
I am trying to manually add url to backend service with Blank API design instead of using LogicApp.
API management preserves operation URL template while forwarding request to backend API. You can use rewrite-uri policy to control that behavior. In your scenario try adding <rewrite-uri template="/"/>
Anyone struggling why this is happening. The url in the front end is being passed in to the back end. You can either make it empty, add a policy to trim that off

Best way to use database connection for every get/post request in .net core web api service

I have .net core web api service. Should i open new connection and close for every get/post request? Or, is there a performance way to use db connection like a global connection variable?
Yes. You use the AddDbContext extension method to configure your DbContext and it'll automatically create a Scoped instance of the context which is created and disposed with each request:
var connection = #"Server=(localdb)\mssqllocaldb;Database=EFGetStarted.AspNetCore.NewDb;Trusted_Connection=True;ConnectRetryCount=0";
services.AddDbContext<BloggingContext>
(options => options.UseSqlServer(connection));
For a full example visit: https://learn.microsoft.com/en-us/ef/core/get-started/aspnetcore/new-db?tabs=visual-studio

Setting up SSRS server with alternative to anonymous authentication

I am trying to set up a VM with SSRS report server.
The SSRS reports on the report server has to be accessible from an iframe on another web site / server.
When I'm accessing the report server URL on an external computer browser I have to enter credentials for the VM user.
On the following link it says that anonymous authentication is unsupported: https://technet.microsoft.com/en-us/library/cc281310(v=sql.105).aspx
The only solution I have at the moment is to enter the credentials in the URL like "http:userLogin:userPassword#myDomain.com/ReportServer".
However this solution exposes my VM user in the iframe code.
How do I set up my SSRS server so I can access the SSRS reports from any computer's browser without having to enter VM credentials?
Is there an alternate solution to anonymous authentication in this scenario?
Thanks in advance
You can provide a custom auth extension for SSRS that handles security. And while these are a bit complex, a custom auth extension that enables anonoymous access is trivial.
See https://learn.microsoft.com/en-us/sql/reporting-services/security/authentication-with-the-report-server
and the SSRS 2016 sample here: https://github.com/Microsoft/Reporting-Services/tree/master/CustomSecuritySample2016
You can also proxy traffic to SSRS using your own HTTP handlers or perhaps IIS ARR. If doing by hand you would configure SSRS to use HTTP Basic auth and add the basic auth header when you make the HTTP request from your application.
I have to find out, and the solution that is working for me
It was set Basic Authentication into SSRS , this into the file:rsreportserver.config of ReportServer
<AuthenticationTypes> <RSWindowsBasic/> </AuthenticationTypes>
--------------------------------------------------------------
**and into the code:**
String url="http://<ipreportserver>:8080/ReportServer?/MyReport&rc:Parameters=false&rs:Command=Render&rs:Format=PDF";
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new
System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
var byteArray = Encoding.ASCII.GetBytes("myuser:myuserPwd");
client.DefaultRequestHeaders.Authorization = new
System.Net.Http.Headers.AuthenticationHeaderValue("Basic",
Convert.ToBase64String(byteArray));
try
{
httpResponse = await client.GetAsync(url);
if (httpResponse.IsSuccessStatusCode)
.....
I hope this will help.. thank you

windows 10 app development - Mediaplayer

I am using below code to play mp3 file from some url (https://domailname/a.mp3), this server required jwt token for authenticating the request.
how can i play the audio from any url which requires authentication
System.Uri manifestUri = new Uri("https://domailname/a.mp3");
mediaPlayerElement.Source = MediaSource.CreateFromUri(manifestUri);
mediaPlayerElement.MediaPlayer.Play();
You may put the token in the URL as a query parameter if under under the following circumstances described on this thread.
System.Uri manifestUri = new Uri("https://domailname/a.mp3/?jwt=jwttoken");
MediaSource instance can create from AdaptiveMediaSource. If the media is adaptive source you may try to create a AdaptiveMediaSource by CreateFromUriAsync(Uri, HttpClient) method firstly. Put the token as value of Authorization Header using the bear schema, and add the header to HttpClient by the DefaultRequestHeaders property. For this you may reference the scenario 3 of AdaptiveStreaming official sample.

How to get client certificate inside web method at asp.net web forms c#?

I configure IIS to get certificates from client. And I can easily get client certificate inside event handler, for example Page_Load
HttpClientCertificate cert = Request.ClientCertificate;
Now I need to create web method what will get client name from certificate and return data for this client. But how can I get client certificate inside static web method where I don't have access to Request?
In any method, including in a static method, you can use HttpContext.Current. If this is non-null, then you can access the Request property. If that is non-null, then you can access the ClientCertificate property.
Of course, it may be null...

Resources