• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4556
  • Last Modified:

WebForm_AutoFocus( textbox.ID ) causes JavaScript Error

Once I moved my web application to a newer virtual server I started getting JavaScript error whenever ASP.NET would add client script.  I have been researching this issue for the last 2 weeks and have tried a series of things to fix the issue.

1.  In most cases it has been a mapping issue of .axd file type on the web site but in my case I have checked this on the default web site and web site in question.  I have went as far as deleting it an recreating it.

2.  I have add an auto generated <machineKey /> to my web configuration file.  This caused an error so I added <pages enableViewStateMac="false" /> which took care of the machineKey error but did nothing to the JavaScript error.

Please any thoughts, ideas, or 'just give this a try' would be greatly appreciated.
0
KPMT-Technician
Asked:
KPMT-Technician
  • 10
  • 8
4 Solutions
 
sunithnairCommented:
What is the error you are getting by the way? Can you please post the error or a link to your page so that we can take a look at? Alternately you could go to the IE->internet options->advanced tab->and uncheck the disable script debugging option and refresh your page. When is asks for debug press yes and see which line creates problem.

pages enableViewStateMac="false" is to do with viewstate and such does not fix any javascript error
0
 
KPMT-TechnicianAuthor Commented:
133  <script type="text/javascript">
134  //<![CDATA[
135  WebForm_AutoFocus('txtUsername');//]]>

ERROR --> Line:135. Object expected.

Result -->  No focus on the textbox.  

Overall Result -->  Making data entry 3 times as long because they keep having to use the mouse to move to new fields.
130  <script type="text/javascript">
131  //<![CDATA[
132  WebForm_AutoFocus('txtUsername');//]]>
133  </script>

Open in new window

0
 
sunithnairCommented:
Can you please check your html source (from browsers view source option) and see if there is a reference to webresource.axd file in that page? I think the reference to webresource.axd file is missing from your page and this is the file that contains the WebForm_AutoFocus function
0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 
KPMT-TechnicianAuthor Commented:
Line 34:  <script src="/WebResource.axd?d=JJojstVdalAvW8VhcvMQ8w2&amp;t=633456125034102880" type="text/javascript"></script>

Line 37:  <script src="/WebResource.axd?d=Cd2m_Wtg-RwV8oGhBM5Klg2&amp;t=633456125034102880" type="text/javascript"></script>

I have two different references to it.  I believe that is incorrect.

0
 
sunithnairCommented:
Copy this url into your browser and then save the file, then open the file and see if it has WebForm_AutoFocus function

http://yoursitename.com/WebResource.axd?d=JJojstVdalAvW8VhcvMQ8w2&t=633456125034102880
http://yoursitename.com/WebResource.axd?d=Cd2m_Wtg-RwV8oGhBM5Klg2&t=633456125034102880
0
 
KPMT-TechnicianAuthor Commented:
HTTP Error 404 - File or directory not found.  Internet Information Services (IIS)
0
 
sunithnairCommented:
Hmmm that is the reason then. Those files are missing. Let me see if there is any way around this..
0
 
sunithnairCommented:
0
 
KPMT-TechnicianAuthor Commented:
When I running the application on my development server I am able to get the page and save it.  The WebForm_AutoFocus function us available.
0
 
sunithnairCommented:
hmm so you need to fix it in the production server for it to work properly. Check the solutions given in the posts i gave and see if that helps
0
 
KPMT-TechnicianAuthor Commented:
http://www.robertfidler.com

This is on the same server.  Same issue were the WebResource.axd file is not being reached.  This is an <asp:TreeView />
0
 
sunithnairCommented:
Who manages your IIS? Is it a dedicated server where you can remote desktop to?
0
 
KPMT-TechnicianAuthor Commented:
My Company.  It is a few offices away from me.
0
 
sunithnairCommented:
Can you try some of the options in the links provided that is the only way out. It is a server configuration issue and not related to your code.
0
 
KPMT-TechnicianAuthor Commented:
It finally dawned on me after I reviewed the IIS logs for the web sites that the URL was being re-written witch was cause the 404 error message.  I had installed the FREE version of ISAPI rewrite Versioin 3.1.0.58 for a magento web site that we are hosting.  Being that it is a free version I can only set a root configuration file.  ISAPI rewrite was change the requested url causing the 404 error.  Once I commented out all the lines in the ISAPI rewrite config file everything started working correctly.

sunithnair - thank you for all your help in the matter, i am going to award all the points to you because with out your help I would have never noticed this was happening.
0
 
KPMT-TechnicianAuthor Commented:
Outstanding effert by sunithnair, thanks again!
0
 
sunithnairCommented:
My pleasure Thanks :)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 10
  • 8
Tackle projects and never again get stuck behind a technical roadblock.
Join Now