After installing .NET 4.5 to my web server I'm getting script errors trying to access my AbleCommerce store in Internet Explorer. I've tried setting the site to target .NET 4.0 again but it still doesn't work in IE so I'm not sure what's going on. I'm not sure if this is a Ajax Toolkit issue or something changed after installing .NET 4.5.
I CAN login using Chrome and FireFox but accessing the login page (click My Account or Login on the top right) shows a script error if you have IE's settings to show script errors.
Any help would be GREATLY appreciated.
SCRIPT5007: Object expected
login.aspx?ReturnUrl=%2fMembers%2fMyAccount.aspx, line 539 character 1
document.getElementById('ctl00_wpm_Login_ctl03_LoginValidationSummary').dispose
= function() {
Array.remove(Page_ValidationSummaries, document.getElementById('ctl00_wpm_Login_ctl03_LoginValidationSummary'));
}
(function(id) {
var e = document.getElementById(id);
if (e) {
e.dispose = function() {
Array.remove(Page_ValidationSummaries, document.getElementById(id));
}
e = null;
} })('ctl00_wpm_Login_ctl04_RegisterValidationSummary');
Page_ValidationSummaries gets populated with ALL validation summaries, even for controls that are not rendered to the browser
Which means it ends up with nulls in it.
Or in this example here, you are trying to remove "null" from the array, which is the converse issue.
I had to roll back to .NET 4.0 by uninstalling 4.5 from the server (and then reinstalling 4.0) to resolve this. Could not find a solution.
Related
I am trying to use a WebBrowser in a .cs class in a Web Application - NOT A WINDOWS FORM app using (VS 2019).
I know it's a Windows Form app control, but it seems like I should be able to use it in a Web App.
Using WebBrowser in Web App does not have the .Url property, so I just use the .Navigate directly - this is where the code breaks.
I have tried many suggestions on the Net, but nothing seems to work - it looks like most of the examples uses a Web Page - I want to use the WebBrowser directly in code (.cs class).
private static void LoginViaUserAgentFlow()
{
Thread thread = new Thread(delegate ()
{
StringBuilder sb = new StringBuilder(String.Format("{0}/services/oauth2/authorize",
RHOutlook.chosenInstance.sfdcURL));
sb.Append("?response_type=token");
sb.Append(String.Format("&client_id={0}", RHOutlook.chosenInstance.clientId));
sb.Append(String.Format("&redirect_uri={0}", System.Web.HttpUtility.UrlEncode(RHOutlook.chosenInstance.redirectUri)));
WebBrowser webBrowserSFDCLogin = new WebBrowser();
//Here I can't use the .Url becaue it is not available - so I just use
//Navigate to get to the site
webBrowserSFDCLogin.Url = new Uri(sb.ToString());
//This is were it breaks, comes back with error when I navigate to the site.
webBrowserSFDCLogin.Navigate(sb.ToString());
//This code is never reached - failed at above code.
if (webBrowserSFDCLogin.LocationURL != null && webBrowserSFDCLogin.LocationURL.StartsWith(RHOutlook.chosenInstance.redirectUri))
{
//webBrowserSFDCLogin.ScriptErrorsSuppressed = true;
webBrowserSFDCLogin.Stop();
}
});
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
}
I expect to be able to navigate to the external website. If I can navigate to the site if I copy the url directly in a browser (say Chrome).
I tried using ; this gives me the Url property, but still get the error.
You really should stick to suggestions and examples.
What you are trying to do is to use class that is designed for Windows Application inside a Web Application.
Those two frameworks are similar like Earth and Mars. I am afraid you are not going to be able to grow a tree on Mars.
When We use Telerik UI for ASP.NET AJAX's telerik:RadAsyncUpload control to upload multiple photos (have preview before being uploaded), it works on all browsers in my local dev environment and our test server. It works on Chrome and IE in our beta and prod servers. But it doesn't work on Firefox in our beta and prod server; it kicks user out and redirect them to login page. We debugged into it and found the reason is that the session is lost. For some reason, Firefox will cause session lost.
Our beta and prod servers have load balancer while our test server doesn't. But even try individual ip address (not using domain name) in beta/prod, it still have the same problem.
Our code is based on the following link's sample code.
http://www.telerik.com/support/code-library/preview-image-before-it-have-been-uploaded-with-radasyncupload
I am not sure if this problem is related to Telerik control, or is it just a FireFox problem. It seems to me more like the latter.
This problem is really weird. It has been several weeks and we are still not able to solve it.
We have fixed the problem. The problem is still FireFox's bug, as indicated in that post
http://www.telerik.com/support/code-library/preview-image-before-it-have-been-uploaded-with-radasyncupload
The trick part is how to fix this bug: delay 10 ms before calling showThumbnail(...). Notice you cannot put the delay inside showThumbnail(...), that doesn't work.
window.CurrentFileUploaded = function (radAsyncUpload, args) {
...
if (navigator.userAgent.indexOf("Firefox") != -1) // if FireFox, delay 10 ms. This is the fix for FireFox bug!!!
{
setTimeout(function () { showThumbnail(...); }, 10);
}
else
{
showThumbnail(...);
}
}
I have a telerik rad editor. My application runs in .net 2.0 environment. The telerik version is : 2012.3.1016.35. The rad editor is not enabled on chrome only. I cannot type into it.Works fine in all other browsers. Upgrading to new telerik is not an option. Because this is an old client and changing will/may affect other styling things.
So what are my options. I posted this on telerik, but no response. If you need more information, please let me know. Thanks.
EDIT:
ON checking the console I got an error. Please find the image attached to see the error.
SOLUTION:
I got it. I had a line like below to open a rad window:
rwSC.VisibleOnPageLoad = True
This was causing the problem. Sometimes it would open fast and the control would load and I can place my cursor within the rad editor within the rad window and sometimes cannot. So I replaced that with this
Javascript.RegisterStartupScript(Me, "NewSC", "setTimeout(""$find('" & rwSC.ClientID & "').show();"", 500);", True)
And now it works. The rad editor within the radwindow is enabled and I can edit it.
Is this what you have: http://feedback.telerik.com/Project/108/Feedback/Details/125713?
If so, try the JS workaround there
I'm using ASP.NET 4.5 on the server and I have a .NET Windows application with a Web Browser control that navigates to the web page on the server.
If I run the Windows application on a system with Internet Explorer 11, I get a script error: "Object doesn't support property or method 'attachEvent'" when navigating to another page. The script file is ScriptResource.axd so it isn't any of my scripts.
I do know that Internet Explorer 11 doesn't support attachEvent anymore (replaced with attachEventListener?). That is however not of much help here, as the javascript is part of the framework, not in my code.
I found the javascript source for the framework here:
http://ajaxcontroltoolkit.codeplex.com/SourceControl/latest#Client/MicrosoftAjax/Extensions/Sys/WebForms/PageRequestManager.js
// DevDiv Bugs 100201: IE does not set referrer header on redirect if you set window.location, inject anchor node instead
// dynamic anchor technique only works on IE
if (Sys.Browser.agent === Sys.Browser.InternetExplorer) {
var anchor = document.createElement("a");
anchor.style.display = 'none';
// cancel bubble so body.onclick is not raised
anchor.attachEvent("onclick", cancelBubble);
// more code...
}
This is the Sys.Webforms.PageRequestManager module that is part of the core ASP.NET framework as far as I understand.
The line that performs attachEvent gives script error on Internet Explorer 11, but works great on older versions of Internet Explorer.
How to fix this problem? Are there any known workarounds? I couldn't fine any updates for this.
Try forcing the browser to render in IE 10 mode...
<meta http-equiv="X-UA-Compatible" content="IE=10" />
I got that problem with jQuery 1.10 and it seems, that IE11 lacks the support of "attachEvent" which is used in jQuery and which seemed to be used by your framework as well. There is a Microsoft bugticket for that: Bugticket attachEvent IE11
I've found a solution in the related jQuery bugticket. Just insert the following code before your framework:
var isIE11 = !!(navigator.userAgent.match(/Trident/) && !navigator.userAgent.match(/MSIE/));
if (isIE11) {
if (typeof window.attachEvent == "undefined" || !window.attachEvent) {
window.attachEvent = window.addEventListener;
}
}
You first check if the browser is IE11 and then bind the attachEvent listener again so the error doesn't occur again.
I've just upgraded my site to ASP.NET MVC 4 Beta to make use of the awesome new Web API functionality, and my site is working great except for one page which uses a particular EditorTemplate, each line I comment out, it says there is an object ref. error on the line above it, I have commented everything else out of this file except for the variable declaration to truly illustrate the weirdness of this problem:
Could this be a bug in the new System.Web.Razor v2.0 .dll shipped with MVC 4? Running under MVC 3 unchanged works fine. Not sure how to get around this :S
Update:
Ok after further investigation, I had one other code piece I hadn't commented out which was:
<div class="opt"><button class="plus#(Html.Raw(ViewData["id"] != null ? " " + ViewData["id"] : null))">+</button>
<button class="minus#(Html.Raw(ViewData["id"] != null ? " " + ViewData["id"] : null))">-</button></div>
It's for creating a stylized spinner button and worked fine in MVC 3, as soon as I comment this out, my page loads fine and the phantom object reference error disappears. I will dissect this culprit html further and see what the new MVC 4 Razor parser could be dying on. Anyone have any initial thoughts?
Ok it appeared that removing the Html.Raw() from the Razor snippet fixed this.
I think this is a new bug with ASP.NET MVC 4, or that Html.Raw() inside html tags are no longer valid. Hopefully an MVC 4 dev notices this post and might address it.
I have no idea why I used Html.Raw() in there so have taken it out and is all functioning fine now. :)