help with script path - asp.net

how do i reference my script properly so when deployed application won't have a problem finding it?
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js "></script>
<script type="text/javascript" src="/Public/Scripts/jqModal.js"></script>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=true"></script>
I'm using VS2008 Web Forms
I keep getting warnings saying:
Warning 3 Error updating JScript IntelliSense: C:\Documents and Settings\myusername\Local Settings\Temporary Internet Files\Content.IE5\2N4L8DWB\jquery.min-fds90[1]..js: Object doesn't support this property or method # 1:17179 C:\Applications\xxx\xxx\index.aspx 1 1

You could use the ResolveUrl method for scripts that are local to your application:
<script type="text/javascript" src="<%= ResolveUrl("~/Public/Scripts/jqModal.js") %>"></script>
The other 2 scripts are absolute urls referenced from external CDNs so they should be fine and you should leave them as is.
As far as the warning is concerned, simply ignore it. Visual Studio Intellisense in web pages is far from perfect. FWIW in VS2010 it's no better. Hopefully they will fix it in vNext.

Related

Deployed Meteor app always returns an HTML file

I deployed my meteor application using this guide, which walks you through nginx setup and writing an Upstart script. Everything works well - I can see that the server is running through the logs in MongoDB. However, making any kind of http request to the app returns an HTML file which looks something like this:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" class="__meteor-css__" href="/936d1dcb9d4c6f9e2d068003929d00edaea39a87.css?meteor_css_resource=true">
<script type="text/javascript">__meteor_runtime_config__ = {"meteorRelease":"METEOR#1.0.3.2","ROOT_URL":"http://appname.myserver.com","ROOT_URL_PATH_PREFIX":"","autoupdateVersion":"3fffc72460404bce55af5963e369702ab5a1a85f","autoupdateVersionRefreshable":"7fbcbd377f48fbf1ff3e288e433b9b5bdb25d6dd","autoupdateVersionCordova":"none"};</script>
<script type="text/javascript" src="/5e974726f55e28b0daf88c48237b1131c3d9b50e.js"></script>
<title>api-rest</title>
</head>
<body></body>
</html>
Every script file it references are just this same file, so this is further evidence that every request is just given this response. I'm very confused since deploying the app with meteor deploy appname.meteor.com works perfectly, and there are no logs in the app's logfile.
Does anyone know how to fix this, or know how to begin debugging it?
Use mup: https://github.com/arunoda/meteor-up.
Diginatocean's guide might be outdated, never worked or both. Overall it seems too complicated for such a simple task.

SharePoint App Model - 500 Server Error loading JS from SharePoint

We are trying to get up and running with SharePoint App Model development. However, we are running into a problem.
Firstly, let me state that we have a DNS entry that routes all sundomains in the form of:
*.ourdevserver.ourappdomain.net to the IP of our devserver.
When our app loads, it runs out and attempts to load three js files from SharePoint. Those requests look like this:
MS Ajax:
http:// apps-13c02829da8acd.ourdevserver.ourappdomain.net/_layouts/15/MicrosoftAjax.js
sp.runtime.js:
http:// apps-13c02829da8acd.ourdevserver.ourappdomain.net/_layouts/15/sp.runtime.js
and finally sp.js:
http:// apps-13c02829da8acd.ourdevserver.ourappdomain.net/_layouts/15/sp.js
The GET for each of these files fails with a 500 server error (not a DNS error). This, in turn, prevents the app from working correctly. The code that loads these files is the default code that is created when you start a new SP app project in Visual Studio:
<script type="text/javascript" src="/_layouts/15/MicrosoftAjax.js"></script>
<script type="text/javascript" src="/_layouts/15/sp.runtime.js"></script>
<script type="text/javascript" src="/_layouts/15/sp.js"></script>
Now, I can change the script reference to dispense with the app-xxxxx subdomain and it will work just fine pulling the three files from ourdevserver.ourappdomain.net/_layouts/15/MicrosoftAjax.js. So, it feels like this is an issue with IIS being able to handle the request.
Any ideas?
You can try like this
<script type="text/javascript" src="_layouts/15/MicrosoftAjax.js"></script>
<script type="text/javascript" src="_layouts/15/sp.runtime.js"></script>
<script type="text/javascript" src="_layouts/15/sp.js"></script>
It work for me, becasue your app want get parent side's js files which not allowed.

SignalR wont load signalr/hubs in IIS in ASP.Net web app

I have a simnple example signalR app that works fine using the VS Development Studio server, however it fails to work when I switch to using IIS.
I have tried all versions of the declaration of the script for it,
<script src="/signalr/hubs" type="text/javascript"></script>
<script src="../signalr/hubs" type="text/javascript"></script>
<script src="http://localhost/TestApp/signalr/hubs" type="text/javascript"></script>
<script type="text/javascript" src='<%= ResolveClientUrl("~/signalr/hubs") type="text/javascript"></script>
All to no avail. It still sees /signalr/hubs as a 404 error when using the developer tools in chrome or IE. Any ideas would be greatly appreciated.
I already have the line
GlobalHost.DependencyResolver.Register(typeof(IConnectionIdGenerator), () => new MyConnectionFactory());
In the Application_Start of the global.ascx . but it seems a tho some initialisation is not happening server side.
p.s. this is asp.net NOT asp MVC.

security warning for javascript and css file?

I am using SharePoint Server 2007 Enterprise with Windows Server 2008 Enterprise. And I am developing using VSTS 2008 + C# + .Net 3.5 + ASP.Net + javascript (jQuery).
I met with the following security warning in browser (at the top of the page in IE) when browse a page -- "An add-on for this web site failed to run. Check the security settings in Internet Options for potential conflicts." The function I developed works fine besides the security warnings. I am using IE 8. Any ideas why there is security warnings and how to resolve?
Here is the code I added to BlueBand.master to refer the js/css files in head section. I am developing a webpart which such script files will impact (i.e. my webpart will generate a div called "tabs" which such below scripts will impact). Any security issues?
<link type="text/css" href="_layouts/test/themes/base/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="_layouts/test/jquery-1.3.2.js"></script>
<script type="text/javascript" src="_layouts/test/ui/ui.core.js"></script>
<script type="text/javascript" src="_layouts/test/ui/ui.tabs.js"></script>
<link type="text/css" href="_layouts/test/demos.css" rel="stylesheet" />
<script type="text/javascript">
$(function() {
$("#tabs").tabs();
});
</script>
thanks in advance,
George
This most likely has nothing to do with your code.
SharePoint 2007 includes active-X controls. Depending on your browsers security settings and the sites internet zone, you may not be able to load those components and hence the security warning.
Here is a MS KB article that explains
http://support.microsoft.com/kb/931509

ASP.NET MVC IIS7 Better configuration

I have a simple but script and css fashioned ASP.NET MVC Application, within the VS2008 Development server everything goes well, but when I bring it to IIS7 I experiment some ugly script and images issues.. Scripts are not found by relative paths (this expecially in the default routed page) and images too.
After some research and googlin' I found many examples and provided solutions, but anything really solves the problem, Someone says one solution soude be using the Url.Content method but I hate to use it because I lost all the javascript intellisense feature in VS2008..
I found too this issue maybe different if the mvc project is shipped in a root web site or in a web application.. I know in a root web site it could works because referencing relative paths like
<script src="../../Scripts/myScript.js" type="text/javascript" />
in a web application folder is resolved without the root.
Anybody has some suggestion or someting else? I Intend after to start something to build a sort of configuration "guide"..
Thaks in advance
It may have been me that suggested using Url.Content. If so, I neglected the other half of what I do -- wrapping a relative path in an if (false) block to retain intellisense. Below is a (full) example of how I handle javascript.
<% if (false) { %>
<script type="text/javascript"
src="../../Scripts/jquery-1.3.1.min.js">
</script>
<% } %>
<script type="text/javascript"
src='<% Url.Content( "~/Scripts/jquery-1.3.1.min.js" ) %>'>
</script>

Resources