Is it possible to hide the Bing maps coordinates for the user ?
This is my javascript code:
var mapOptions = {
credentials : "My app code here",
zoom:#(Model.Sprint.ZoomFactor),
center:new Microsoft.Maps.Location(latitude, longitude),
showDashboard: false,
disableUserInput: true,
enableSearchLogo: false,
enableClickableLogo: false
};
In my html source, the coordinates become visible to the user but the user is not allowed to see where the exact location is.
Does anyone know how to hide them?
Im using ASP.net MVC 3 so the coordinates come from a viewmodel.
thanks.
As long as you are using the Bing maps javascript control, you cannot really hide this information from the user. The code is running on the user's machine, so how can you hide your source code and data from them? If your requirement is that the coordinates should not be visible in the downloaded source code, you can try something similar to the Bing interactive SDK, where they use an ajax call issued by the client to obtain the map license key at run time. But this is easily defeated by stepping through the code using the javascript debugging feature on your browser.
Related
This is how the Auth0 login screen appears when I open it from a C# WPF app:
Auth0 login window
The top portion can't be seen. There are no scrollbars and the window cannot be resized. Only the full screen option allows the user to see the entire login form.
Here's the code I'm using to open it:
try
{
var auth0 = new Auth0Client(
Properties.Settings.Default.auth0Domain,
Properties.Settings.Default.auth0ClientID);
var handle = new WindowInteropHelper(this).Handle;
var windowWrapper = new WindowWrapper(handle);
var user = await auth0.LoginAsync(owner: windowWrapper,
withRefreshToken: true, device: "DeviceName");
}
catch (Exception e)
{
Utilities.AppendLog("User login exception: " + e.Message);
}
I'd like to resize the window so the user can see the entire login form. What do I need to do?
Misunderstood.
That entire login screen is done by Auth0Client. The window handle you are passing in is just the parent for that popped up login window.
Here's the source code to Auth0Client:
https://github.com/auth0/Auth0.WinformsWPF/tree/master/src/Auth0.Windows
Taking a look at their login screen...it is a Windows Forms "form" which appears to be of a fixed size. Within that "area" they are using a WebBrowser control...which then is using an Auth0 "domain" url to do the actual logging in.
Here's what it looks like for me, when using their sample applications to do a login - it looks different in its layout to you.
Did you change a setting in your Auth0 account to show the login options in a different way (i.e. with labels?) - I'm not familiar enough with Auth0 to know where that option is. Perhaps it is one of their "extensions" you are using?
It's possible that their "web page" design for a login using icon+name style list...doesn't get laid out properly when there are a number of "connection" types....and limited "height" in the "browser".
What you could do is either:
"tweak" that BrowserAuthenticationForm so it has a bigger vertical size, so there is plenty of room to fit the list of login types into
or
if such an option exists, stick to the "icon only" style of list rather than "icon+name"
Also make sure you are using the latest version of Auth0....though I'd think you probably are already...and it probably won't make a difference to the presentation.
Lastly, here's what it looks like if you just use a browser (e.g. Chrome), and size it so that the "client" area height is about 565 pixels...which is the same as the WebBrowser control height in BrowserAuthenticationForm - notice the "title" being clipped (note I only have 4 log in provider options...compared to 5 in yours).
And if you make the browser a bit taller...then you can see it all.
Unfortunately, the way they've designed that popup HTML form doesn't work in limited height situations, and what's more "scrolling" has no effect if part of the "login screen" is being clipped.
(the WebBrowser already has "scrollbars" enabled...so that's not stopping any scrolling).
You mentioned that one of your team modified the login screen and I believe that is defined in the "Hosted Pages" section of the Auth0 admin site....maybe you can tweak that a bit more.
I have a Windows Phone 8.1 XAML app that uses the MapControl to display maps. In the MapControls Loaded event, I set a valid Bing API key
void MyMap_Loaded(object sender, RoutedEventArgs e)
{
MyMap.MapServiceToken = the key
MapService.ServiceToken = the key
}
I know the Bing API key is valid because the watermark in the MapControl is not shown.
From the page with the MapControl I navigate to another Page where in the ViewModel I try to find a driving route:
var driving = await MapRouteFinder.GetDrivingRouteAsync(new Geopoint(new BasicGeoposition
{
Latitude = Latitude,
Longitude = Longitude
}), Detail.GeneralInfo.GpsCoordinates.Position, MapRouteOptimization.Time);
The problem is that driving.Status is always InvaldiCredentials.
Is there something that I am missing?
The documentation says
Note that you have to provide the authentication token in two separate properties in an app that uses both Map services and the Map control.
and I did this.
The Bing API key I use is generated for Basic / Public Windows Phone App. I also tried to generate one for Basic / Public Windows App, no change.
I have a working app that uses this token. I only set it to a Map control in XAML, and then I can use both the Map and the MapService, apparently.
My Maps key token is 22 characters long. The only way to get it is, AFAIK
Make an app
Upload it to the store but do not submit
You app gets associated with a store ID and you will see a map token
THAT is the token you will need
See screenshot. Is that the procedure you followed?
Also, make sure xmlns:Maps="using:Windows.UI.Xaml.Controls.Maps", not the old Bing control. Don't even know if the old control is still available in the Universal Apps btw
I am my first site with mvc 4, site uses heavy async requests and so far they are manageable, basically this is a page which display the records from DB in a grid and allow users to filter them based upon selection from some drop downs which make these requests.
Now the business requirement points to update URL when a filtration occurs so that users can share the filtered records via copy pasting URL, I am wondering if there is a way to achieve it like how instagram show's an image on click in a model popup and also updates the URL so user can share it and so does twitter when navigated through home to notifications.
Any suggestions would be highly appreciated.
Thanks in advance.
Instagram uses the Javascript History API to change the URL via javascript, without a redirect. Take a look https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Manipulating_the_browser_history
// Suppose http://mozilla.org/foo.html executes the following JavaScript:
var stateObj = { foo: "bar" }; history.pushState(stateObj, "page 2",
"bar.html"); This will cause the URL bar to display
// http://mozilla.org/bar.html, but won't cause the browser to load bar.html
// or even check that bar.html exists.
For an MVC-friendly js library, you can use History.JS http://balupton.github.io/history.js/demo/?state=2
I am building a mobile site and the footer has an background.
I want to check if the browser supports css property, background-image, if true display background with specific html, else display a different set of html.
I am using the following :
HttpBrowserCapabilities bc = new HttpBrowserCapabilities();
I can't seem to get a check for backgrounds.
The reason why I want to check for BG-image support is coz I have to switch between 2 sets of html. 1 with html text and bg image, and the other with the text on the image - sliced for each word/link...to give the same effect.
to get information by HttpBrowserCapabilities, you have to use Request.Browser property.
HttpBrowserCapabilities browerCapabilities = Request.Browser;
I think Asp.net will automatically check the type of the browser and render the page accordingly. So if the the browser don't support background images it will not come.
Another idea to solve the issue is getting the browser type by using code, then you can show or hide the background images based on the type.
I recently started working on a project that has been in development for some time now. The problem is this - in the web site page, a have a frame (amongst 4 others) in a frameset which contains the SVG map object (the whole site is GIS based). Also, in the same frame, there is a icon for opening the form in which user can choose a number of filters, and after he presses a button, the map refreshes and the area of influence around some key points on the map are drawn.
What i need to do is to open that form in a new (popup) window and not in the same frame where the map is. I did that this way:
onclick="window.open('zi.aspx','form1','width=700,height=500,left=350,top=100')"
This works fine. But then, when i enter the filters and hit Generate button, i get this error:
'parent.frames.map' is null or not an object
with the reference to zi.aspx. Now i know that this error is because i changed the form from opening in the same frame as map to opening it in a popup window, but i just can't find anywhere in the code where can i modify it. Before my changes, the code was just this:
onclick="showZi();"
and that is the function i can't find anywhere. Any ideas? How can i make this work, to make a map with filters drawn after the user has chosen appropriate ones from the popup window form? I should mention that this image link is in the ASP.NET table, with standard runat="server" command.
Okay, so you're opening a new window from javascript. Your problem is that you're trying to access the parent window by using the 'window.parent' property. This is wrong, you'll need to instead use 'window.opener' property. E.g.:
window.opener.frames.map