AJAX controls get error "Element is not a known element" - asp.net

I've been working on an ASP.NET web application and I recently got a new laptop. I was using Visual Studio Community 2019 using .NET Framework 4.7.2 on my old laptop, so I made sure to get the exact same software/version on my new one. I used Git to clone my project on my new laptop so I'm sure everything is the same. Both laptops are running Windows 10 Home edition.
For some reason on my new laptop, when viewing a .aspx page, the AJAX controls are underlined in green, and when I hover over them with my cursor, I see an error message saying "Element 'x' is not a known element." This happens with all the AJAX controls and with other controls defined within the AJAX controls. Strangely, if I view another .aspx page, the AJAX controls on that page are recognized. What I noticed is whichever .aspx page is opened first will have the unrecognized AJAX controls error, and all other .aspx pages won't have it. Also strange is the project seems to work just fine when I run it, with the AJAX controls that aren't recognized working normally.
The same project open on my old laptop doesn't have this problem. Am I missing some dll file on my new computer? How would I be able to tell what's missing?

Related

Asp.Net - Internet Explorer 10 - Javascript removed from page unless in Compatibility Mode

I have a website built using Visual Studio 2010 (may have been upgraded), running with .Net 3.5 SP1 in Dev and on the Web Server.
When I go to my Login page, in development or on my test server, I can login just fine. The login page depends on a few pieces of auto generated JavaScript code I can only assume are created at runtime by Asp.Net.
One being a JavaScript method called __doPostBack(eventTarget, eventArgument).
When I go to my Login page on my Production Server, the login page doesn't work any more. What I've found is that all of the JavaScript I have in the page Is suddenly gone.
I am also missing a lot of ASP generated hidden input elements. Like,
__LASTFOCUS
__EVENTTARGET
__EVENTARGUMENT
__VIEWSTATEGENERATOR
Now if I enable Compatibility Mode, it all comes right back and works just fine. View Source show's my JavaScript is back and the missing ASP generated input elements are back as well.
Anyone ever seen this?
I did read the article about this being a common issue due to ASP.Net not recognizing IE 10 as a valid browser. Bug and Fix: ASP.Net fails to detect IE10 causing _doPostBack.... is the article I'm referring to.
I find it strange that the KB's this article points to show much later time stamps on the ie.browser files than what I have on my development machine. My machine shows my ie.browser file was created and last modified in 2009. However the KB's show that if I have a good ie.browser file, the timestamp should be Aug 31 2011. So I don't really know why I'm not having this problem on my development machine.

Master Page cannot be loaded in C# ASP.Net publish

I am currently new to ASP.NET C# programming and have created a ASP.net Web application project in visual studio 2010, .NET 4.0. I have researched thoroughly to find a solution to my problem the last couple days but had no luck.
My issue is, debugging my project has no issues running on my local machine. I have a Site.Master page that is reference with a site.css. All my .ASPX pages run through the master site. However when i publish my website using File System
and setting my target location to my desktop, any call on a < href> tag to my default.aspx cannot load the site.master page. the error is as follows:
"The Master Page file 'Site.Master' cannot be loaded.
Correct the problem in Code View".
now i do have IIS 7.5 installed, and i have tried to create a website through the inetmgr by following various steps through google searches and videos and still have no luck. is there something specific i am missing? everything is named the same in reference to stylesheet.
In addition to WraithNath's comment, might want to ensure IIS is configured to allow ASP.NET

ScriptResource not loading

This is an interesting problem...
I've got an ASP.NET 3.5 web application. It's relatively simple - a content page based on a master page, with a couple of usercontrols on the page.
There are a total of four controls on the page; two are custom controls and two are Ektron CMS controls.
For some reason, I've been getting 'Sys is undefined' Javascript errors. The Firebug error console also throws an "ASP.NET client framework failed to load" error. I can't figure out why this is happening.
The kicker - if I take the controls that don't work completely out of the content page, they work just fine. It's obviously something in the content page trashing the framework, but I haven't been able to figure this one out.
I've looked through several dozen articles before posting, including suggestions like:
Repairing the .NET framework (didn't work)
Various web.config tweaks (either already there or didn't work)
regiis -i command (I don't think this will help, since the controls do work when I'm not using the content page)
Commenting out custom scripts on the user controls (didn't work)
Commenting out the other user controls on the page (didn't work)
Create a blank page and drop only the control I'm interested in on the page (this actually works)
Has anyone seen something like this before? It's got to be something in that content page, but I'm struggling with what.
EDIT
I noticed while stepping through the code the UserControl's PAGE_LOAD event fires three times; on the third time the code throws an error. (I'm still trying to get my head around the error that's being thrown)
EDIT
I wanted to add this in case someone else sees this error. It turns out the problem was being caused by a Scriptmanager on the page template that wasn't needed.
When I took the Scriptmanager off the page, everything worked fine and the framework load error went away. I figure this problem must have broken other scripts and prevented them from running later on down the page.
If you get a 404 on ScriptResource.axd, there must be something wrong with your ASP.NET installation. I had this before, when I did not configure the correct ASP.NET pool. For instance: there could be another ASP.NET application on the same server assigned to the same pool, that is running under ASP.NET 2.0. You say your application runs under 3.5. Can you try iisreset on your machine and then start your application?
The pool could be assinged to the wrong .NET version.
Another option could be, that .NET 3.5 is not installed on the server at all.
Are you sure that the site runs well without your content page? ScriptResource.axd is a dynamic handler to generate JavaScript on the fly. If it's not available, the scripts cannot work.
Your use of Sys needs to be AFTER your ScriptManager is setup on the page. The ScriptManager is what instantiates the Sys object.

Contents of a code-behind file is rendered instead of a control

I have a user control which is being added to a page dynamically. It works fine on my computer whether a site is running on an integrated Visual Studio server or deployed to IIS.
But when the site is deployed to a production server, I see the contents of a user control's code-behind file instead of a control.
Have you any ideas what can cause this?
Thank you.
EDIT: The site is running on IIS 6 and here is the code I am using to add the control to a page
`this.Controls.Clear();
this.Controls.Add(LoadControl("MyUserControl.ascx"));`
Yikes. That should never happen. Are other ASP.NET pages working correctly? Are you sure ASP.NET is properly registered on the server? I think you'll need to give us some more information... what version of IIS are you running, and post the code where you dynamically add the user control.

What can cause ASPNET AJAX page to revert to normal ASPX mode ? / UpdatePanel broken

I am using VS 2008 with a very simple UpdatePanel scenario.
But i cannot get UpdatePanel to work and cant seem to find out why
I have in fact reverted to a very simple example to validate it is not my code:
http://ajax.net-tutorials.com/controls/updatepanel-control/
In this example I click on either button and both text links update.
I dont get any errors, the page just behaves like a normal ASPX page.
What things do i need to check. I've been googling this for an hour and not found what I need.
Edit: Works in Visual Studio web server but not in IIS
If it's working locally, but not when deployed to a remote server, that usually indicates that you're using ASP.NET 2.0 and the ASP.NET AJAX extensions aren't installed on the remote server.
If it's a server you have administrative control over, you can download the installer here: http://www.microsoft.com/downloads/details.aspx?FamilyID=ca9d90fa-e8c9-42e3-aa19-08e2c027f5d6&displaylang=en
If it's a web host, tell them to get their act together.
Another option would be to check your web.config. You could for example create an new Ajax enabled ASP.NET website from Visual Studio. This will generate a correct web.config. Copy over all non-ajax sections from your existing web.config and you're set. This worked for me.
-Edoode

Resources