Using google map place api service - c#

I want to use Google Map Place API service in ASP.NET application.
How do I use it and what are the requirements for it ?
var request = {
location: map1.getCenter(),
radius: '20',
query: 'Roberstenstrasse 80, 4310, Rheinfelden, Switzerland'
};
var service = new google.maps.places.PlacesService(map1);
service.textSearch(request, callback);

You can refer to this links and try google map api in asp.net
http://www.aspsnippets.com/Articles/Google-Maps-GeoLocation-API-Example.aspx
http://www.aspdotnet-suresh.com/2013/01/generate-google-maps-api-key-for.html
there are nothing such requirement except a google file
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>

Related

Access token for Google Authentication

I have a ASP.NET MVC web application that uses Google Authentication. The authentication part is working fine. But I am trying to find out how I can get hold of the access token for the login in my code so that I can pass it in the header for a web api that I have and wish to consume.
Here's how you can use Google's Sign-In button template to initialize the login & grant of permissions:
<meta name="google-signin-client_id" content="{{ OAUTH2_CLIENT_ID }}">
<script src="https://apis.google.com/js/platform.js?onload=onLoad" async defer></script>
<div id="google-signin-button"
class="g-signin2"
data-width="170"
data-height="30"
data-onsuccess="onSignIn"
data-onfailure="onSignInFailure">
</div>
function onSignIn(googleUser) {
var profile = googleUser.getBasicProfile();
var idToken = googleUser.getAuthResponse().id_token;
}
You can then pass the idToken (accessToken) to an API.

A system that intergates with Tibco spotfire

I want to develop a system that integrates with Tibco Spotfire and is able to Retrieve Visualizations rendered by Spotfire and expose them for WYSIWYG manipulation. Is this possible?
If so someone please offer guidance. I want to use C# and ASP.NET
first load the javascriptapi for handling client interactions
<script type="text/javascript" src="http://domainname/SpotfireWeb/GetJavaScriptApi.ashx?Version=3.1" > </script>
add the code for adding the spotfire template to web page
create a javascript file in your project with the code below:
function addPlayer()
{
var fileInfo = new FileInformation(SpotfireVisualizationPath,SpotfireVisualizationName,SpotfireParameter, '');
var customization = new spotfire.webPlayer.Customization();
customization.showCustomizableHeader = false;
customization.showToolBar = false;
customization.showClose = false;
customization.showTopHeader = false;
if (app != null)
{
app.close();
}
app = new spotfire.webPlayer.Application(SpotfireWebPlayerURL, customization);
app.open(fileInfo.path, 'SpotfireContainer', fileInfo.parameters);
}
The Spotfire Web Player (which I assume you refer to) is not built in this way - in its current implementation it is more like a remote desktop session to the desktop Spotfire application (if you replace the remote desktop technology with html and javascript).
It simply is not built to be able to grab pieces of the UI for reuse in other contexts. The closest you can do is host the entire web player UI in an iframe and use the javascript API for client-side interactions. By creating single-visualization pages and removing all chrome (toolbars etc) you can get to something that appears to be a single visualization on a page, but it's really just a hack.

Migrating from V5 to V6 of the Facebook C# SDK

I'm trying to migrate from V5.3.2 to V6 of the SDK. I've got an ASP.NET 4.0 Canvas application. I noticed that now there's no more facebook.web.dll (which I previously used), and found this info:
>
Removal of Facebook.Web.dll and Facebook.Web.Mvc.dll
Starting from v6, we are depreciating Facebook.Web.dll and Facebook.Web.Mvc.dll and will no longer be providing it.
...
Starting from v6, you will have to use the Facebook Javascript SDK to get the access token and pass it to the server using secure https connection or use the Facebook OAuth Login Dialog.
Decoding signed request (ParseSignedRequest/TryParseSignedRequest) has been moved to FacebookClient instead.
var fb = new FacebookClient();
dynamic signedRequest = fb.ParseSignedRequest("app_secret", Request.Params["signed_request"]);
<<<<
(http://blog.prabir.me/post/Facebook-CSharp-SDK-Glimpse-into-the-Future.aspx)
So that's all well and good. Previously, I had this in my code behind:
protected void Page_Load(object sender, EventArgs e)
{
var auth = new CanvasAuthorizer { Permissions = new[] { "user_about_me" } };
if (auth.Authorize())
{
ShowFacebookContent();
}
}
To change it, I've now got the Javascript SDK successfully loading and logging in my user:
<div id="fb-root"></div>
<script type="text/javascript">
FB.init({ appId: 'xxxxxxx', cookie: true, status: true, oauth: true });
FB.getLoginStatus(function (response) {
if (response) {
alert(response.authResponse.accessToken);
}
});
</script>
I've tested this and it successfully logs in the user. But how do I then get it to do a postback and call the server side method that it was calling before (ShowFacebookContent)? I assume that whatever I do will have to pass the accessToken or the SignedRequest so that fb.ParseSignedRequest will work and on the server we can generate a FacebookClient.
I'm guessing that several people will be in a similar situation, trying to migrate off of facebook.web.dll, so any guidance would be really great.
Depending on your need pass either the signed_request or the access_token.
And also don't pass the access_token over http. Use secure https connection.

Google Analytics API display page views

Using .NET MVC 3, I'd like to display page views on each page of my site. I have google analytics set up.
I'm aware there is an API, but have no idea where to start.
Any pointers for what I need, and more specifically what to be looking at for displaying page views?
Create a file in your Views/Shared folder called _GoogleAnalytics.cshtml (using the underscore in the front is a method of indicating a partial view. It has no effect in MVC, it's just a practice I see done a lot in demo's and screen casts.
Put your google analytics code in it. (make sure to put in your own identifier from Google)
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-########-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
Then in your _Layout.cshtml page add this line (assuming you are using Razor)
#Html.RenderPartial("_GoogleAnalytics")
Edit: Just re-read the question, It just occurred to me what you may be looking for is a means to display just the hit counter using data pulled from Google Analytics API?
Which if that's the case I think I missed that part. I've not done this myself but this may be a good start?
http://code.google.com/apis/analytics/docs/mgmt/mgmtFeedReference.html#profileFeed

Using Bing API in C#

How do we use the Bing API in C#? I have to pass a query to the Bing API and then get the results.
BingService.BingService service = new BingService.BingService();
SearchRequest request = new SearchRequest();
// use your Bing AppID
request.AppId = ""; /* Your App ID */
request.Query = "rose"; // your search query
// I want to search only web
request.Sources = new SourceType[]
{
SourceType.Image
};
SearchResponse response = service.Search(request);
foreach (ImageResult result in response.Image.Results)
{
//lstBxImages.Items.Add("" + result.Title);
imgliteral.Controls.Add(new LiteralControl("<img src=" + result.MediaUrl + " width=100
Download bing dlls from microsoft site and add those dlls . Then only we can able to use bing service.
Here's something will help you a lot
https://github.com/insatmc/BingMapHelper
Just adding to above there is a full documentation of te API given by BING in a PDF.
Here is a Basic Details Version
hii..
Add a bing reference to web references in an application and use search.wsdl

Categories