jquery not working in asp.net mvc after publishing to localhost - c#

I've built an mvc application which contains some jquery code. When I run the app from my ide, everything works perfectly. When I publish to the server and open the page, the jquery does not work. I get object expected errors.
i am not getting anything in the page,it shows error in loading dhtmlxsheduler.js
can you help me out

You issue is most likely due to the way you are defining the path to the JavaScript file you are loading.
Make sure that you use a relative path, and not an absolute path when calling the file source.
If you have runat="server" you can also use the ~ operator, which ASP.Net translates to your home directory.
Read more here http://msdn.microsoft.com/en-us/library/ms178116.aspx

Your links to the .js files are broken. See the source code of your pages in your browser, and check the tag's src attribute. It must be pointing to the wrong place.

My guess is removing ../ do you have iis express? or development server? or iis?
Or use a CDN like this one from Google:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>

Related

Issue in routing in existing ASP.NET application

I have a problem with routing in an existing ASP.NET application for work. I have the code for the application and i can build and run it. When i run it I see the home page, but all links and images have invalid URL's. For each URL the same problem occurs.
For example an image on the home page has this src:
src="/appName/Images/img.jpg".
but the image is actually at "/Images/img.jpg". Notice the missing '/appName', this is the problem with every link / image.
The root folder of the application is in the folder '/appName', but the URL's/images seem to think it is one folder above that.
Now I could change every URL and take out the '/appName', but I feel like it should be possible to run the website correctly without changing the code. Maybe i should change something about the environment or IIS express.
HttpContext.Current.Server.MapPath("~") returns the path to the /appName folder. So the img src and a href start looking in /appName/appName which doesn't exist.
I have searched online, but cannot find anything.
I've already tried changing the root URL in applicationhost.config, but this resulted in IIS not finding an application in that folder.
I know the website works in the production environment, though i currently have no access to the production environment. But i do think it is an environmental setting (maybe in IIS).
So does anybody have an idea how to change it so the links think the root URL is one folder above the actual root folder in IIS?

ASP.net page not loading CSS with error Failed to Load Resource

I have asp.net application which I am running on local host. When I browse page loads but its not able to pick any css and js and I get error as
Failed to load resource: the server responded with a status of 404 (Not Found)
(see screenshot) .
Any pointer as to what could be wrong here?
On a different server, same page loads fine with all images.
Check your paths -- you may need to use a relative path instead of an absolute. Also, confirm that you can navigate to the css and js files from your browser using the path that you see in the console (you probably will not). Finally, check your IIS settings and make sure you can server Static files.
Include all your files or css and any from Project PC to Deployment server

Is it possible to use .asp extension for ASP.NET code?

I want to ask if it's possible to configure server to work with .asp extensioned files as with ASP.NET pages. Or it's absolutly denied to not mix new code with old ASP?
You could place a *.asp file on your server that redirects to your final destination. I've had to do this a few times when we didn't want to break legacy hyperlinks.
Configuring Handler Mappings in IIS 7 would be the section that in theory you could specify which handler to use though this presumes you are using IIS 7.
It is not possible to mix both *.asp and *.aspx pages because the configuration differs for both and my suggestion is to convert everything to .asp /.aspx.

Publishing asp.net single page to ftp server?

i'm trying to publish a webpage into my ftp server, thing is when i publish it and try to access it, the result is just pure code . How can i make it so that only the "design" of the asp file appears?
Thanks in advance,
Bruno Charters
How can i make it so that only the "design" of the asp file appears?
If all you want to appear in the browser is the "design" (meaning no server-side logic). Then all you'd really need is an HTML page. To do so:
copy the markup rendered by the .aspx file from the browsers source
paste the markup into an appropriately named .html/.htm file
upload the file to your server
If there is server-side logic then you'll need to upload the .aspx file to a server that has IIS and the appropriate version of the .NET Framework to run the page.
You will need to compile your code before you publish it. Compiling your code basically moves all the logic into the .dll file and leave only the HTML (well, at least). You will still need a Web Server with aspx processor, typically IIS.
You will need to point your Web Server to the folder you are uploading to.

Why is my MVC app throwing a blank page?

Deploying my ASP.NET MVC 2 application to an IIS7 staging server leads to a blank page, regardless of the action called. Attempts to access controller actions that require authentication are correctly redirected to /Account/LogOn, but this page too shows only a blank page on both my local machine and the remote server.
I have checked my site permissions and I think it is an assembly issue, but no errors show up in the Application log.
How do I determine the cause of the error?
I recently installed ASP.NET MVC 3 on my dev machine, but made no changes to this project and I am using StructureMap for DI, if that makes a difference.
You could try installing Elmah from Nuget.
In the Package Manager Console, type install-package elmah. Then run your app.
Also, if you're not actually getting any errors, have you checked the rendered source in your browser? Your master page could have something commented out in it. Probably not though!
Another suggestion would be to empty the bin directory completely after doing a Clean Solution, rebuild, and try again.
In cases like this, it generally helps breaking the problem down to the smallest steps needed to replicate the problem. In your case, remove all routes, barring the one/s you need, empty out your master page and view to just a very simple 'hello world' and also comment out any code in your action so that it's not going off to the database or whatever else.
If you have an Application_Error handler in the Global.asax, maybe that hides the error.
When I got this problem, there was an error in the web.config

Categories