|
I have deployed an ASP .NET application with a JavaScript Google Map on the home page to a Windows 2012 website. Now when I browse to the application it comes up fine except the Google Map never loads. One thing that does work is if I publish it as a Web Application and using localhost works. It's just when it's published as a website to IIS is where it fails. As a WebSite on the F12 Console windows debugger here are the errors I'm getting:
SEC7120: Origin http://mymachinename not found in Access-Control-Allow-Origin header.
SCRIPTING7002: XMLHttpRequest: Network error 0X80700013, Could not complete operation due to error 80700013.
getPreferences failed when constructing GPToolsService: undefined
<script type="text/javascript">
var map;
MoW.ready(function () {
map = new MoW.Map({
target: 'MoWmap'
});
});
window.onload = function () {
MoW.ready(function () {
if (document.getElementById('<%= KMLOPString.ClientID %>').value !== "") {
var overlayPropertiesOP = {
"name": "Openations KML",
"url": document.getElementById('<%= KMLOPString.ClientID %>').value,
"type": MoW.protocols.KMLProtocol.TYPE.STRING,
"description": "Demonstrating KML overlay",
"mapTypeId": "google.map.mapTypeId.ROADMAP"
};
var newOverlayObjectOP = MoW.Factory.createKMLOverlay(overlayPropertiesOP);
map.addOverlay(newOverlayObjectOP, {
showAlert: true
});
}
if (document.getElementById('<%= KMLESString.ClientID %>').value !== "") {
var overlayPropertiesES = {
"name": "Exercises KML",
"url": document.getElementById('<%= KMLESString.ClientID %>').value,
"type": MoW.protocols.KMLProtocol.TYPE.STRING,
"description": "Demonstrating KML overlay",
"mapTypeId": "google.map.mapTypeId.ROADMAP"
};
var newOverlayObjectES = MoW.Factory.createKMLOverlay(overlayPropertiesES);
map.addOverlay(newOverlayObjectES, {
showAlert: true
});
}
});
}
function kmlBtnClick() {
var overlayProperties = {
"name": "Example KML Overlay",
"url": document.getElementById('<%= KMLESString.ClientID %>').value,
"type": MoW.protocols.KMLProtocol.TYPE.STRING,
"description": "Demonstrating KML overlay"
};
var newOverlayObject = MoW.Factory.createKMLOverlay(overlayProperties);
map.addOverlay(newOverlayObject, {
showAlert: true
});
map.setBasemap(google.maps.mapTypeId.ROADMAP);
}
</script>
modified 3-Feb-20 8:18am.
|
|
|
|
|
We're a small internal dev team and we have an .NET & AngularJS web site, except the site is supposed to act as a host of other sites/applications. So the users go to a single address, they can then get to the other apps via a dashboard, but the core site handles the 2 different authentications (windows and custom oracle database based) and other common features. Currently the .NET side is all separate projects for each app. The AngularJS is just one app.
Ideally we'd want the applications to be more independent, so that we could update one and be comfortable saying that regression testing of the others isn't needed.
Some guidance on:
How would you design the web side? I was thinking separate angular apps with the 'host' site using iframes? As I couldn't think of another way to keep the whole look and feel with out code duplication.
The authentication, its OAuth/Owin, the windows AD and Oracle are separate, but the same user could have creds for both. We've currently got two 'client_ids' in the single web app, which doesn't seem right, as I'm tracking two access_tokens. I'm thinking I could use OAuth claims instead.
We are also planning rewriting from AngularJS, would anyone recommend an alternative framework? I'm half thinking of Blazor, to reduce the number of languages the team needs to know, but obviously its still new, so the amount of resources about and its long term viability are risks.
Apologies for the rambling post
|
|
|
|
|
I'm trying to call a Web API hosted on my server from a Xamarin Forms app.
This Works
private string GetServerMessage()
{
var result = string.Empty;
using (var client = new WebClient())
{
client.Headers.Add("Content-Type:application/json");
client.Headers.Add("Accept:application/json");
result = client.DownloadString(url);
}
return result;
}
This Doesn't Work
It hangs on the Client.GetAsync line
private async Task<string> GetServerMessageAsync()
{
string response = string.Empty;
HttpClient client = new HttpClient();
client.BaseAddress = new Uri(url);
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage responseMessage = await client.GetAsync(url);
if (responseMessage.IsSuccessStatusCode)
{
response = responseMessage.Content.ReadAsStringAsync().Result;
}
return response;
}
It the right way to call the Web API from Xamarin Forms? Why is the async calll hanging up?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
That's usually an indication that there's a deadlock trying to call back into the UI thread. That's often caused by using sync-over-async - waiting synchronously for an async task to complete.
I notice you're using .Result within your method to read the content, rather than await ing the task. You probably have other places in your code doing something similar.
Try adding .ConfigureAwait(false) to the async calls, and removing the .Result access:
private async Task<string> GetServerMessageAsync()
{
string response = string.Empty;
HttpClient client = new HttpClient();
client.BaseAddress = new Uri(url);
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage responseMessage = await client.GetAsync(url).ConfigureAwait(false);
if (responseMessage.IsSuccessStatusCode)
{
response = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false);
}
return response;
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
As I have created a mock data in sevice.js but I want to handle the api by passing mock URL using webservice to close the activity using httpget method .
**View.html**
<a class="button is-danger is-outlined m-b-sm" ng-click="onActivityClose()" prevent> **Service.js**
activityClose: function (data) {
if (
data.projectActivity.original_value == data.projectActivity.estimated_end_value &&
data.projectActivity.original_value == data.projectActivity.revised_value &&
data.projectActivity.original_value == data.projectActivity.payment.total) {
var response = {
"status": false,
"message": null,
"reconcile_list": {
"variations": [
{
"id": 1,
"reference": "21.004",
"status": {
"code": "ENDORSED",
"label": "Endorsed"
},
"actioned_date": "2019-12-25 10:00:01"
}
],
"reconcile_sap_fec": {
"sap_po_value": 100000.01,
"fec_value": 90000
},
"reconcile_sap_payments": {
"sap_po_value": 100000.01,
"payment_value": 100000
}
}
};
return $q.resolve(['Success']);
}else{
$log.error('Action activity close returns undefined');
return $q.reject(['Unknown response!']);
}
},
**view.js**
onActivityClose: function() {
UTIL.confirm(
"<p>You are about to close a project activity .</p><p class='has-text-weight-bold'>" +
$scope.data.projectActivity.reference +
" " +
$scope.data.projectActivity.description +
"</p><p>Please confirm your action by clicking the appropriate button below.</p>"
).then(function(confirm) {
if (confirm) {
serviceFcrs.webservice
.activityClose($scope.data)
.then(function(_response) {
$scope.$emit(
"notify.success",
"Activity has been closed successfully"
);
if (
data.projectActivity.original_value == data.projectActivity.estimated_end_value &&
data.projectActivity.original_value == data.projectActivity.revised_value &&
data.projectActivity.original_value == data.projectActivity.payment.total) {
$scope.data.userCanCreatePayment= false;
$scope.data.userCanCreateVariation= false;
$scope.unlockButton= false;
$scope.closedButton= true;
})
.catch(function(error) {
$log.error(error);
});
$scope.$emit(
"notify.alert",
"<h1>Activity cant be closed</h1>: " + error
);
return false;
});
}
});
},
modified 15-Jan-20 6:11am.
|
|
|
|
|
I have edited your post so it is readable. But it is still missing any explanation of your problem. I suggest you add some details so people can try to help you.
|
|
|
|
|
Hello,
So I am currently struggling with PHP MVC model. I am tryng to write a simple app that will get user input from index.html (Name, surename, email) - Validate/sanitize input and insert the data in database. Return errors if any.
So I am currently failing to understand which file (Model, controller) is responsible for collecting the data from html form and inserting it into variables - example:
if (isset($_POST["submit_button"])) {
$username = ($_POST["username_input"]);
$password = ($_POST["password_input"]);
}
Where do these lines go? Is it a good practice to create a seperate .php file just to collect user input and pass it further? (to controller/model)
I can't create an additional class for this since, everything that is inside a class needs to be a function, but I cannot call a PHP function when submiting an HTML form.
Example:
class inputCatcher {
}
This won't work because it's a class and it needs a method.
Any ideas?
|
|
|
|
|
I am a backend developer using php(Laravel) to develop web applications having 2 years of work experience.Now I want to learn new technology either Angular or React.I don't know which one is having more future scope.can any one suggest me which one is better.
|
|
|
|
|
Member 14705443 wrote: which one is better. That will depend on your requirements; what is better for you may not be so for some other developer. As to which one has the best future, you need a crystal ball to foretell fortunes.
|
|
|
|
|
React is more meaningful in terms of the more modern JS developer stack. Angular allows you to use a more old-timey approach, but has its own challenges in terms of architecture. Both will have a bit of a learning curve.
I stopped using Angular when they claimed they would be releasing a new major version every 6 months. Screw that.
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor
|
|
|
|
|
There is a considerable amount of debate going to find out which is the better choice for front-end development on whether AngularJS or ReactJS?
ReactJS and AngularJS both of them are robust development technologies. AngularJS is designed and managed by Google, while Facebook and its community members maintain ReactJS. These are built on JavaScript that enables advancement and customization to develop advanced web applications.
While both of them are quite popular front end frameworks, This article provides a comparison of how both AngularJS and ReactJS intends to solve the front-end challenges, along with differences in approach and philosophy.
|
|
|
|
|
Angularjs and reactjs both are the template of javascript.You cannot say on of them is no best. Main differences between Angularjs and Reactjs are following
The version of angularjs has been updated in march 2019 and the version of react js has been updated in october 2019. It means that the reactjs is latest from angularjs
Huge difference between both of them is that the author of reactjs is facebook and the author of angularjs is google.
These are the main differnce between angularjs and reactjs.
|
|
|
|
|
So I am currently trying to write an PHP function which updates fields within a table (mysqli database):
The code that I currently have in my PHP code function is:
public function insertValue($id, $attribute, $value){
try {
$stmt = $this->connect()->query("UPDATE attributes SET ".$attribute." = ".$value. " WHERE id = ".$id);
} catch (Exception $e) {
return $e->getMessage();
}
Where the parameters are being passed from another .php file:
if (isset($_POST['box2__submit'])) {
$id = $_POST['box2__userid-input'];
$attribute = $_POST['box2__attribute-input'];
$value = $_POST['box2__value-input'];
$DB = new db_class();
echo $DB->insertValue($id, $attribute, $value);
Now the problem is that everything works fine untill I pass a value that is letters for example passing - "Hello" with $value throws an error:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'Hello' in 'field list'
However if I pass values that are numerical, for example - 1337, it works just fine. I have no idea what's wrong and how can I fix this.
Help!
|
|
|
|
|
The error is because you are building an SQL statement and not quoting the values. You don't have to quote numeric values, but strings do need to be quoted.
I also have to point out that you should never build an SQL statement with user input unless you sanitize your inputs somehow. Little Bobby tables[^]
The mysqli driver supports prepared statements with placeholders, so using that is an easy way to fix it.
|
|
|
|
|
I managed to get it working with the following query:
"UPDATE attributes SET $attribute = ".$value. " WHERE id = ".$id;
As for security, Yes I have my own field validator which checks and removes all bad symobls ('' etc)
Thanks.
|
|
|
|
|
I recently created a web-accessible intranet site for a customer (it's an internal business application, but hosted on an external shared host so has a "public" domain name). It's SSL-secured and password protected. Today a user reported a page within the site being flagged by Norton Safeweb (a browser plug-in) with the heading "Scam Insight: Personal Information Risk". It's a full-screen warning that says the site is "not well established with the Norton Community. Use caution when entering" and has a large button "Exit site" and a smaller link "Continue to site".
It seems Norton "rate" sites and the extension dynamically blocks access to sites they - Norton - have not whitelisted. There's a (very buggy) process to register as the owner of a site (which involves uploading an encoded HTML file - god knows what it contains - and then getting Norton to verify), however registration as owner does not in itself whitelist the site. You need to explicitly request assessment (which I've done) but it can take a while, and it seems that if they then deem your site "unsafe" that they will continue to block it. There's a dispute resolution process but it seems people spend a lot of time fighting inappropriate ratings from Norton.
This is unilateral censorship of the web, without explanation of what any issue is. (Other virus checkers may warn about a mismatched or expired SSL cert, for example, but the warnings are generally explicit about the problem, and there is a clear issue). Norton don't make any attempt to notify a site owner if they block access to it unless the site owner has registered. It doesn't apply in this case, but suppose I'd spent marketing dollars driving potential clients to a commerce site - I'd be losing both visitors and income.
Am I over-reacting about this? Does it seem fair? What are other people's experience with Norton SafeWeb, and does anyone know what they're even looking for??
modified 26-Dec-19 13:25pm.
|
|
|
|
|
Not being "well established with the Norton Community" may be perceived as a promise of quality, imho
"Five fruits and vegetables a day? What a joke!
Personally, after the third watermelon, I'm full."
|
|
|
|
|
Hours of googling and endless articles is what i've gone trough, but still haven't found a direct answer.
What makes CSS Reusable? Or what is considered Reusable CSS?
As I understand it has something to do with class names, i.e - images images-footer, heading-heading-first etc.
Can anyone explain please?
|
|
|
|
|
Basically answering my own question, so that this maybe helps others that came across this.
So after doing more research, I found out that by reusable CSS:
"There are some significant shortcomings that makes CSS difficult for reusability, modularity, and maintainability. Features like nested selectors can be tempting to use but lead to brittle, difficult to maintain code that doesn’t stand up well to changes in the HTML. There also isn’t a single standard to use when making organization decisions for your CSS. However there are some methodologies that are commonly used to organize CSS at scale.
1. BEM
2. SMACSS
3. OOCS"
This article explains it: - https://medium.com/@afrench53198/reusable-maintainable-and-modular-css-b0ffedf1c208[^]
|
|
|
|
|
I have 4 div boxes and each div box has elements inside them, which are h1 headings, p paragraphs and buttons.
All 4 div boxes are centered in the middle of the page by using:
position: relative;
After that I have added:
Top:
Left: positions to position Divs.
My question is do all other elements inside the page, that are inside those Div boxes also need Position: Relative | Left: | Top:
Or should I just position them by using margin-top/left, padding-top/left?
Of course both methods will work, but what is the best practice?
Also, Do all elements need the:
Display: block; | inline | Inline block
Attributes ? Or is it fine to position them without these elements?
|
|
|
|
|
|
What's the consensus on the security of using a webservice (asmx) for general database entry? Secure, not secure, better than using .NET SQLDatasource? Interested in feedback and if there's anything better that I can use.
|
|
|
|
|
I really have not heard of anything bad about SqlDataSource, but I am not a fan of it and prefer to use code-behinds or web services of some type or another
Director of Transmogrification Services
Shinobi of Query Language
Master of Yoda Conditional
|
|
|
|
|
|
I want to improve my website speed
|
|
|
|