Showing posts with label server. Show all posts
Showing posts with label server. Show all posts

Wednesday, March 28, 2012

Update to Beta 2.0 and can not run on Server

I have recently upgraded my Web Page to use the new AJAX 2.0 beta. I have also included the November CTP. This works fine on my local PC, but when I run it on my Server, it blows up.

I had initially included all of my DLL's in the Bin folder. After reading many of the posts, I decided to install the ASPAJAXExtSetup.msi and ASPAJAXCTP.msi onto my server. No joy.

I get the following error message:

Server Errorin'/EDCC_Test' Application.------------------------Index was outside the bounds of the array. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack tracefor more information about the error and where it originatedin the code. Exception Details: System.IndexOutOfRangeException: Index was outside the bounds of the array.Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identifiedusing the exception stack trace below. Stack Trace: [IndexOutOfRangeException: Index was outside the bounds of the array.] EDCC.PageBase.curUser() +687 File_Home.Page_Load(Object sender, EventArgs e) +92 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34 System.Web.UI.Control.OnLoad(EventArgs e) +99 System.Web.UI.Control.LoadRecursive() +47 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061 ------------------------Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210

I am not sure where to start debugging this code. As I stated above, it works fine on my machine, but not from the server.

Can someone help point me in the correct direction? Is there a way to "Debug" the page from the server side like from within Visual Studio? Maybe allowing me to "step" through the code? Is there a way to show a more verbose error message that will point me in a better direction?

Thanks,

Bryan

PS: Before I upgraded my site to the Beta 2.0, it was running fine. (Thank goodness I had the foresite to try to install it onto a "test" site before making it live.) Big Smile

hello.

well, it looks like you're passing an index too big for an array.

to see how to get more info about the error on an asp.net, take a look at the <customerrors> element.


Hello,

I agree with Luis. I mean i'm not completely sure that by upgrading you broke something. You probably have a dropdownlist or maybe an array that isn't getting data put into it. What does your code look like? What does the data access layer look like?

Not sure of any way to actually do debugging on the server like you can in the VS2005 IDE, unless you can recreate the environment on your local machine (Database, Web Application etc.)

VS2005 Team System Developer includes the ability to do unit tests. This allows for you to actually step through your code and make sure that all of the pieces are logical and you don't have issues that would show up until you actually loaded up the website onto the server and tested.

Good luck and happy thanksgiving.

JoeWeb


Thanks all for your replies.

I figured out my problem by republishing a million times with different "Response.Write" and "Response.End" statements until I found the error.

I am developing an Intranet site, and I rely on the Windows user name to authenticate. When I created a "test" web site on my server, I had the "Allow Anonymous Logins" box checked somewhere in the properties. Once I removed this, it worked flawlessly. Jeesh, newbie mistake.

Bryan

Saturday, March 24, 2012

UpdatePanel and CompositeControl

Hi,

I want to make a custom date selector server control. I am inheriting from the CompositeControl base class. As usual I override the "CreateChildControls" method and add my controls to the "Controls" collections. Among them is an UpdatePanel that should contain a Calendar control. I'm having problems creating and adding the UpdatePanel. How should I go about doing this?

This is my code so far for the "CreateChildControls" method:

namespace

Test.Presentation.Web {
publicclassDateTimeDropDown :CompositeControl {
UpdatePanel _updatePanel;
Calendar _calender;
testTemplate _template;
protectedoverridevoid CreateChildControls() {
_calender =newCalendar();
_updatePanel =newUpdatePanel();
_template =newtestTemplate(_calender);
_updatePanel.ContentTemplate = _template;
_updatePanel.ID =this.UniqueID +"_up";
this.Controls.Add(_updatePanel);
}
}
classtestTemplate :TemplateControl,ITemplate {
Control _control;
public testTemplate(Control control) {
_control = control;
}
publicvoid InstantiateIn(Control container) {
container.Controls.Add(_control);
}
}
}

I get the error message:System.InvalidOperationException: The UpdatePanel 'Test1_up' was not present when the page's InitComplete event was raised. This is usually caused when an UpdatePanel is placed inside a template.

I'm quite new to makeing custom controls so I'm probably missing something obvious here. Any suggestions to how I can accomplish this?

Thanks!

Ole Gulbrandsen

Pherhaps it is not possible to include an update panel in a composite control?

hello.

well, you can if you instantiate it before the init event (as the previous error reported)


Hi, thanks. This code works:

public class DateTimeDropDown : CompositeControl {
UpdatePanel _updatePanel;
Calendar _calender;
protected override void OnInit(EventArgs e) {

_updatePanel = new UpdatePanel();
_updatePanel.Mode = UpdatePanelMode.Always;
_updatePanel.ContentTemplate = new testTemplate();
_updatePanel.ID = "updt";

_calender = new Calendar();
_calender.ID = "cal";
_updatePanel.Controls.Add(_calender);
this.Controls.Add(_updatePanel);
base.OnInit(e);

}
}
class testTemplate : TemplateControl, ITemplate {
public void InstantiateIn(Control container) {
}
}

The above code, work, but if I build composite control of this one again I get into problems. I need to understand more of whats going on. Does anyone know any good sources for reading about how updatePanels fit into the page life cycle and how to incorporate them in custom controls ?

Ole


hello.

hum...i guess that there's not much to say:

* you have to add the trieggers till the end of the init event
* the panel initializes its template during the oninit event

i think this is all :)

you asked for resources...well, i guess that currently you only have .net reflector ;)


ok, I'll experiement a bit more with this, hope Microsoft can provide more documentation soon.

thanks for the help!

UpdatePanel and client-side script error in IE, but not in Firefox

<atlas:UpdatePanel runat="server" ID="up" Mode="Always">
<ContentTemplate>
All sorts of controls here
</ContentTemplate>
</atlas:UpdatePanel
I have two DropDownLists. When the user selects an item in the first DropDownList, there is a postback and the 2nd DropDownList gets populated.

All works fine in Firefox 1.5.0.1.

In IE 6, I get this client-side error:
"Assertion Failed: elements in children collection should always have nodeType = 1
Break into debugger?"

And if I break into debugger, the only line is:
"debugger;"

Thanks.Dear,

I have this problem now :)

[],

Ramon Dur?es
It would be nice to post a complete code or at least something distilled down to generate the same error. Both posts claim some issue, but without the code it's difficult for others to investigate this problem.
OK, this was not easy to reproduce. It's a crazy bug :)

<%@. Page Language="C#" %
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
<script runat="server">
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
this.DropDownList2.Items.Add(new ListItem("xyz"));
}
</script
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<atlas:ScriptManager ID="sm" runat="server" EnablePartialRendering="True" />
</head>
<body>
<form id="form1" runat="server">
<div>
<atlas:UpdatePanel runat="server" ID="up" Mode="Always">
<ContentTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" AutoPostBack="True">
<asp:ListItem>abc</asp:ListItem>
<asp:ListItem>def</asp:ListItem>
</asp:DropDownList><asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="DropDownList1"></asp:RequiredFieldValidator>
<br />
<asp:DropDownList ID="DropDownList2" runat="server">
</asp:DropDownList>
<!-- remove this to make UpdatePanel work in IE -->
</ContentTemplate>
</atlas:UpdatePanel>
</div>
</form>
</body>
</html
Just remove the HTML comment, and it works!
Hi,

please checkthis thread.
Hi

I have had this problem with the March release. removing thecomments did resolve it. However i dont understand why this is?
I guess its not a big problem to simply not comment in the html but still seems like a strange restriction.

Garbin. You mention in the other thread that the release fileswill not do this and recommend to reference them? I dont follow, i addthe script folder to my project and create a reference to thedll. Then in the config file....
<add tagPrefix="atlas" namespace="Microsoft.Web.UI" assembly="Microsoft.Web.Atlas"/>
<add tagPrefix="atlas" namespace="Microsoft.Web.UI.Controls" assembly="Microsoft.Web.Atlas"/
How do i specifically refrence the release js files?

thanks
o
I got the same problem. I have the latest dll and took all the comments off the page.

I have this textbox that when it posts back it finds the client. If I use it with Firefox it works (after I took off the comments), but if I use IE, it does the search but it freezes up and never shows the information.

Thanks.
Hi,

you could use the ASP.NET notation

<%-- This is a comment --%>

to make comments inside an UpdatePanel.
Now I don't get the error message, but the page freezes up.

I'm using master page, and when I use regular page it works fine and all the fields are completed, with the master page, it finishes the search and that's it, no error message at all.

Thanks.
Hi,

the problem may be related to the id of a control being modified by its container (the MasterPage), but I'm just guessing. Could you post some code?
Thanks for your answer Garbin.

I don't know if this is relative or not, but the master page was using MagicAjax, so I just deleted the MagicAjax Panel from it and it worked.

My guess is the MagicAjax javascript was modifying something. Now it works.
I have the problem too.
and I a another problem.
when I use UpdatePanel on the webPart Zone Control.one webpart zone left a Updatepanel,but when I drop the webpart from a webpart zone area to another.
there will show the message:
"Assertion Failed: Duplicate use of id "WebPart_gwpBookConsumer1" for object of type "Sys.UI.Controls.WebParts.WebPart".Break into debugger?"

The problem exists in Firefox too.

thanks.
same problem here

This is a known issue, and we are currently investigating. See this thread:http://forums.asp.net/thread/1232325.aspx

-Mike


Is fixed in the Atlas April CTP:http://weblogs.asp.net/atlas/archive/2006/04/10/442437.aspx

-Mike

Wednesday, March 21, 2012

UpdatePanel and form validation on the server side

Ok here is what I am experiencing. I have an UpdatePanel on my page. I am performing form validation on the server side by throwing an exception if the validation fails. This is working fine until I set custom errors to "RemoteOnly" in the web.config file. This makes sense since I am throwing an exception.

So the big question is how can I perform server validation on form fields with out throwing an exception?

Thanks!!

While we work closely with the ASP.NET AJAX team when developing the Toolkit, they're the real experts on general ASP.NET AJAX issues. Your problem doesn't seem to be directly related to the Toolkit, so we'd appreciate if you considered posting to one of theother newsgroups such asAJAX Discussion and Suggestions. Your post will be more helpful to others looking for similar advice if it's in the right place. Thank you!

UpdatePanel and Javascript - Preload Images?

Im having a problem,

When i use the following javascript in the <head runat="server">... other head items..

<

SCRIPTtype="text/javascript"LANGUAGE="JavaScript">

<!-- Begin
image1 =

new Image();

image1.src =

"/images/header.jpg";

// End -->

</script>

</head>

That code seems to break the timer and updatepanel. Any ideas? I see no errors on the client side, except that it doesnt update on the interval I've chosen, but when i remove the preloader code it works. ?!? Anyone have work arounds?

Try putting the script in an external .js file and reference that file in the scriptmanager:

<atlas:ScriptManagerID="ScriptManager1"runat="server"EnablePartialRendering=true>

<Scripts><atlas:ScriptReferencePath="/inc/helperscripts.js"/></Scripts></atlas:ScriptManager>

philmccracken:

Try putting the script in an external .js file and reference that file in the scriptmanager:

<atlas:ScriptManagerID="ScriptManager1"runat="server"EnablePartialRendering=true>

<Scripts><atlas:ScriptReferencePath="/inc/helperscripts.js"/></Scripts></atlas:ScriptManager>

Hmm, I do that and now I get object not found error in IE. (line 2,123 something..) I see the correct reference in the HTML output. If you wish to check that implementation its onwww.smackfm.com, perhaps Im using wrong way to implement Preloading of images and its causing the timer to break?


Can you run javascript on the fly in an external script file? (I don't know, I've never tried). Maybe you need to put that inside a function and then run the function? Either by adding an onload to the body tag, or maybe with page.registerstartupscript? I'd play around with it... (Unless someone wants to post that knows for sure...)


try thisDevil [666]
<script type="text\javascript"> var img = new Image(); img.src = "/images/header.jpg";</script>

UpdatePanel and Server.transfer

I have a gridview inside a updatepanel that, based on the click of a button (commandbutton) postback to server and process the some code (associated with the command event) the page fails to do a Server.transfer("xx.aspx") The code is executed but the page "postback" to the old page not the
"transfer to page". Can't you do an Server.Transfer from a control inside a AtlasPanel ??


hello.

well, i think you won't be able to do that. if you use fiddler, you'll notice that you're getting a pageError element (which doesn't really gives any util info).

though i'm not sure about it, i'd say that you're getting an error from the application itself since the pageerror event of the control isn't being fired.

I'm a little bit puzzled as well. It seems that through this update panel, which is doing a partial rendering of a page, you can't end execution of the main page because of the page's lifecycle. Honestly, that is just a guess. I would be curious to hear from Mike or someone on this.

\=)


Server.Transfer does not make sense when you use updatepanels - the client is expecting fragments of rendering to update an update panel, and not an entire new html document. For buttons that result in Server.Transfer, make sure they aren't set up as triggers for update panels.
i also had encoutner this problem.
does anyone have any solution for this problem?

Hi,

As Nikhil pointed out, doing a Server.Transfer doesn't really make sense in an AJAX callback situation.

Also, it seems according to microsoft unless you're writing an ApplicationController Server.Transfer is probably not a good concept to use at all as it doesn't sit very well with search engines. I guess the only other time one would perhaps use it is if you want to display completely different pages based on certain criteria (like depending on if the user has logged in), but I would think this determination is probably best done in a HttpHandler. I myself usually dynamically load user controls for that though.

Nick


You may as well try Response.Redirect.

Hi,

Response.Redirect have the same (logical) problem.


Hi!

I know that this thread is a bit old, but I had a similar problem with Server.Transfer and UpdatePanels.

I found a working solution athttp://brunokenj.net/blog/index.php/2007/04/09/utilizando-servertransfer-e-aspnet-ajax-10/

Look at the first comment of the blog entry to get the code I am using.

It would be nice If I got some opinions about this solution.