ASP.Net scripts isn't loading - asp.net

I have a problem with my Scripts in my Web-Application. I work about an local Website with ASP.net and IIS Express. But the Scripts doesn´t load correctly.
Css and js Files
Code

Error is 404(not found). that mean js url path on your solution not correct.
to solve it:
Drag any JS file from solution explore and drop it into aspx page html. then replace all js files paths exists on the same directory with the new path without name of js file name

Related

Customized CSS codes not loading in ASP.NET MVC

I add a style sheet file to my project for customized style sheets. this file is in this path: ~/Content/MyStyle.css
When I run my project this file exists in the browser but there isn't any code in it.
Even I append my codes to Site.css file, those codes are wrote by mvc as default are exist, but those codes I added is not exist.
I'm confused. I wrote some code but not appear in browser.
Can you help me?
thanks
This is most likely a caching issue. You have to hard-refresh your browser. Try pressing ctrl+shift+R or ctrl+F5.
This will make sure that your modified files are requested from the server.
You can also change caching settings for your local development environment. Refer to MSDN on how to make a web.debug.config config transformation and what settings to change.

jQuery UI does not work in ASP.NET MVC project

I am trying to use the jQuery UI library in my project. I have downloaded a jquery-ui-1.10.2.zip.
Then I've extracted files inside, copied and pasted .js and css files into corresponding packages(Contents, Scripts). Then I've added these lines in Bundle.Config.cs:
bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
"~/Scripts/jquery-ui.js",
"~/Scripts/jquery.ui.dialog.js"));
and so on. Then I've rendered in _Layout.cshtml:
#Scripts.Render("~/bundles/jqueryui")
But it does not work. Can anybody help me?
I did everything perfect. I've got no error while running, but after running the project on browser, I had a look at the compiled source code of the page, then I understood that path to the script is Scripts/jquery-ui.js, but my page is located ar View/Home/ while scripts are located at Scripts/ folder. Then I just, changed the path to proper one. That's all:=)

The changes not updating on server

I have build MVC 5 application which works fine when running via VS. When I publish it to the server first time it also works. Now I have made few correction to my css file and publish whole project again but website still see the old css file. I have removed all files from the server and tried few more times but it is still the same. When I check the css file on the server, the changes are inside the file.
I think it is related to MVC bundling as when I check the source it says that is accessing different file which is not even located on the server:
<link href="/Content/cssmain?v=Ikj7NnMg3q9kTHR7ynWOJDQFGMZl3mtVMi_2EkOJxc41" rel="stylesheet"/>
How can I force VS to minificate my css file again?
I've tried cleaning, rebuilding but no luck
Edit:
My bundle set up look like below and all files are located on the server in Content folder.
bundles.Add(new StyleBundle("~/Content/cssmain").Include(
"~/Content/bootstrap.css",
"~/Content/site.css",
"~/Content/ilightbox.css",
"~/Content/bannerscollection_zoominout.css"));
Many thanks
I think it is related to MVC bundling as when I check the source it says that is accessing different file which is not even located on the server:
CDN location? External Css lib (yours or 3rd party)? unsure what you meant by "not located on server"?
Yup, it does (look like ASP.net Bundling in action) - check your Global.asax, App_Start/BundleConfig or _AppStart and see if the bundle configuration setup point to/reference the "correct" locations for your css (and or script).
Is it just you experiencing getting the old css file loaded? Or anyone who views the site?

How to call WebPage in folder from another WebPage in a folder

I am working in VS2010 ASP.NET, I decided to move some of my pages in folders and they reference pages in other folders. When I run in virtual debug mode in VS it runs ok, but when I deploy it on the host server the pages cannot see each other. i tried using ../FolderName/Webpage.aspx, ~/FolderName/Webpage.aspx and still no avail.
However if I have a webpage that is not in a folder and then reference a page in a folder it works fine. Anyone else have this issue?
The best practice is to use ResolveUrl to reference all resources such as javascript files, css files, etc.
For example:
<script src='<%=ResolveUrl("~/Javascript/datables-extensions.js")%>' type="text/javascript"></script>
As far as pages referencing other pages, you should be able to use the relative path (../Folder/other_page.aspx) without any problems. Don't use absolute paths or your website will have issues like you describe when you deploy to a different environment that has a different folder structure.

servlet filter mapping for url-pattern to target specific path in url

I am using jawr. I want to map only js files which has "bundle" folder in its path (/bundle/*.js ) so that other js files which i have it as tag works fine.
currently, if i specify url-mapping as *.js...it will intercept all *.js files. So it starts giving 404 for those files.
I am not sure if this will fix issue, but i think thts only way i can tell jawr script servlet to avoid other js files.
details about my issue
http://java.net/projects/jawr/forums/discussion-forum/topics/655-Included-file-in-jsp-contains-numeric-folder-that-does-not-exist

Resources