CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > windows_hosting.hosting_open_forum Tags:
Item Type: NewsGroup Date Entered: 5/6/2004 2:56:41 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 15 Views: 23 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
16 Items, 1 Pages 1 |< << Go >> >|
grmAbay
Asp.Net User
Dynamic control5/6/2004 2:56:41 PM

0/0

Hello,

I've got a strange thing happening to my website. I am putting controls dynamically on my webpage, depending on user interaction.

The first few times, this works ok. When I come back a day later, some pages don't work anymore and return an error message. I then open my web.config file, do some dummy change, save it, and everything works ok again for a few hours. What's whrong?

This is the error message, it appears exactly where I expected the custom user control:

System.Configuration.ConfigurationException: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS. (c:\inetpub\wwwroot\ZeescheldeBrowser\web.config line 6) at System.Web.Configuration.HttpConfigurationSystem.ComposeConfig(String reqPath, IHttpMapPath configmap) at System.Web.HttpContext.GetCompleteConfigRecord(String reqpath, IHttpMapPath configmap) at System.Web.HttpContext.GetCompleteConfig() at System.Web.HttpContext.GetConfig(String name) at System.Web.UI.CompilationConfiguration.IsBatchingEnabled(HttpContext context) at System.Web.Compilation.PreservedAssemblyEntry.BatchCompileDirectory(HttpContext context, String baseVirtualDir) at System.Web.Compilation.PreservedAssemblyEntry.GetPreservedAssemblyEntry(HttpContext context, String virtualPath, Boolean fApplicationFile) at System.Web.UI.TemplateParser.GetParserCacheItemFromPreservedCompilation() at System.Web.UI.TemplateParser.GetParserCacheItemInternal(Boolean fCreateIfNotFound) at System.Web.UI.TemplateParser.GetParserCacheItemWithNewConfigPath() at System.Web.UI.TemplateParser.GetParserCacheItem() at System.Web.UI.TemplateControlParser.CompileAndGetParserCacheItem(String virtualPath, String inputFile, HttpContext context) at System.Web.UI.TemplateControlParser.GetCompiledType(String virtualPath, String inputFile, HttpContext context) at System.Web.UI.UserControlParser.GetCompiledUserControlType(String virtualPath, String inputFile, HttpContext context) at System.Web.UI.TemplateControl.LoadControl(String virtualPath) at Com.Amecspie.Zeeschelde.Browser.Pages.Main.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\ZeescheldeBrowser\Home\Main.aspx.cs:line 32
tonyjay
Asp.Net User
Re: Dynamic control5/7/2004 7:20:11 AM

0/0

Hmmm, I had a similair problem to this when I first started out with ASP.NET. I might be wrong here, but how is your IIS setup ? It sounds almost as though you don't have a virtual directory setup and have actually just stuck all your files, including web.config in a subdirectory of your site.

If that's the case, create a virtual directory instead and see if that fixes your problem.
grmAbay
Asp.Net User
Re: Dynamic control5/7/2004 2:12:04 PM

0/0

The virtual directory is set up correctly. The thing that puzzles me is the fact that it runs ok for some time:

1) The site works fine.
2) After a some time of running normally, the error finally shows up.
3) I change the web.config file (forcing the JIT complier to run again)
4) Goto point 1 ;-)
tonyjay
Asp.Net User
Re: Dynamic control5/7/2004 3:09:22 PM

0/0

Well, that's about it for me then. The only time I've seen what you describe is with applications nested inside the paths of applications. IE if you had two applications:

http://www.mysite.com
Mapped to c:\wwwroot

and
http://www.mysite.com/wibble
Mapped to c:\wwwroot\wibble

That might cause you problems because the /wibble path could be both just a subdirectory of the main app or a VDir .... this has caused problems for me before, in exactly the way you describe....
grmAbay
Asp.Net User
Re: Dynamic control5/12/2004 12:07:26 PM

0/0

Nope, this is not the case.

I tried removing all the register statements in the html of my .aspx page
<%@ Register TagPrefix="uc1" TagName="Home" Src="Home.ascx" %>

Now the error is constant, but only with certain user controls, not with all of them. I'm trying to check which are ok, and which aren't.

Any ideas are welcome.
grmAbay
Asp.Net User
Re: Dynamic control5/12/2004 12:22:51 PM

0/0

I have gotten to the bottom of the debug I could be doing:

The error occues when I reach this code in my .aspx.cs file:

string ControlPath = "MyUserControl.ascx";
UserControl userControl = (UserControl) LoadControl(ControlPath);

The Page_Load event of the usercontrol I'm trying to load doesn't get executed.

This happens only for SOME user controls, not all of them. NONEof these controls are referenced in the page header with a statement as follows:
<%@ Register TagPrefix="uc5" TagName="Test" Src="MyUserControl.ascx" %>

tonyjay
Asp.Net User
Re: Dynamic control5/12/2004 1:42:12 PM

0/0

Two things:

1) After you load the control, you ARE adding it to a control collection somewhere aren't you?

and

2) If you ARE adding it, which I assume you will be, can you post the code to your ASCX including the code behind.

Tony
grmAbay
Asp.Net User
Re: Dynamic control5/12/2004 2:09:55 PM

0/0

Yes, I am adding it to a placeholder's control collection.

This is my aspx page:
<%@ Page language="c#" Codebehind="Main.aspx.cs" AutoEventWireup="false" Inherits="Com.Amecspie.Zeeschelde.Browser.Pages.Main" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML><HEAD>
....
</HEAD>
<body MS_POSITIONING="FlowLayout">
<form id="Main" method="post" runat="server">
<asp:placeholder id="Information" runat="server"></asp:placeholder>
</form>
</body>
</HTML>

This is the Page_Load method from my aspx.cs (code behind)
private void Page_Load(object sender, System.EventArgs e)
{
try
{
//Information is the placeholder where I add the new control
Information.Controls.Clear();

//ControlPath reads the current control to load (relative to the current page)
//If this path doesn't exist, I get an IO exception
UserControl userControl = (UserControl) LoadControl(ControlPath);

//Add the control to the placeholder
Information.Controls.Add(userControl);
}
catch (Exception exc)
{
lblErrorMessage.Text = exc.ToString();
}
}

The usercontrols I load like this are all pretty straightforward, but I don't think it makes any sense to post them here. I don't get to the Init event of these user controls when the exception occurs, so the code doesn't even get interpreted.
tonyjay
Asp.Net User
Re: Dynamic control5/12/2004 2:31:42 PM

0/0


The reason for wanting the ASCX code behinds was because you said the Page_Load wasn't being called in them, and I wanted to check you still have this.Load += new .....(Page_Load) in the OnInit override....but you're telling me that the Init doesn't occur either now, so forget that.

Anyway, thinking about this a bit more, the ControlPath variable is set to just a simple string value isn't it ? eg: mycontrol.ascx - is that ASCX file in the same location as the ASPX file ?

I'm struggling to see this happen without being able to re-create the problem. Can you create a small example with one of the user controls that doesn't work, and the ASPX page, and post it in it's entirety so I can see the problem with my own eyes.

My only other question is - the controls that are giving you problems - do they by any chance have any caching setup within them ????

Cheers,
Tony
grmAbay
Asp.Net User
Re: Dynamic control5/13/2004 7:42:59 AM

0/0

The Load event of the .aspx page is being raised. It's the Load event of the user control that isn't reached. I'm not using any caching either.

ControlPath is indeed a string. The application has a rather flat directory structure. The main directory has all the general stuff (web.config, default.aspx...) all the rest is stored one directory deeper.

It is possible that the user control I want to load is in a different directory than the aspx page. Therefore, the ControlPath always contains a string in this format "../[DirectoryName]/[ControlName].ascx".
If something was misspelled in this string, or the directory or .ascx file didn't exist, I would get an IO exception. This is NOT the case.
Again, the thing that puzzles me is that some controls in a same directory work, and others don't.

tonyjay
Asp.Net User
Re: Dynamic control5/13/2004 1:25:16 PM

0/0

Righto then...

where you have ControlPath equalling ../, that doesn't take it outside of the application path does it ?

You say the load event of the control isn't being fired. Check to ensure that your controls OnInit override adds your Page_Load function for the control to the Load delegate, otherwise it won't fire. (And VS.NET 2003 *has* removed this delegate assignment for me in the past and I've had to manually code it back in)

Finaly, again, humour me and post a full example - I just can't recreate the problems you're having....

Cheerio
grmAbay
Asp.Net User
Re: Dynamic control5/13/2004 2:39:48 PM

0/0

I'll send you the solution if you give me your email address. Mine is [email protected]
grmAbay
Asp.Net User
Re: Dynamic control5/13/2004 3:03:50 PM

0/0

I now did a few tests.

I set a breakpoint on my aspx Page_Load event handler at
UserControl userControl = (UserControl) LoadControl(ControlPath);

In my watch window, I added
HttpContext.Current.ApplicationInstance.Server.MapPath(ControlPath)
System.IO.File.Exists(HttpContext.Current.ApplicationInstance.Server.MapPath(ControlPath))

Each time a user control was loaded this way, I could check if the ascx file really existed. No problem. The path was correct, and the File.Existst() always returned true.

Just to remind you:
1) The program works fine for a while. To me this means that the code is not at fault.
2)After a while, it doesn't run anymore for SOME controls. The page_Load of the aspx page gets triggered, the Page_Load of the faulty controls not anymore, because an exception is raised BEFORE the Load event of the control.
3)When I modify my web.config file in a trivial way (removing a parenthesis, then adding it again, then saving the file), the application runs smoothly again. (goto 1 ;-) )

I am at a loss here. I could send you the code like stated above. If you would be so kind as to try it out, that would be great.
tonyjay
Asp.Net User
Re: Dynamic control5/13/2004 3:53:30 PM

0/0

hi again,

I'll reply directly, then when we find the solution, we'll post the answer here.....

Cheers,
Tony
grmAbay
Asp.Net User
Re: Dynamic control5/24/2004 8:59:09 AM

0/0

OK everyone, here's the solution, and as always, it's pretty easy, but as easily overlooked:

The path to the control was a string in theis format : "..//directory//usercontrol.ascx". Notice anything wrong?

THESE ARE NOT ESCAPE SEQUENCES!

It should be: "../directory/usercontrol.ascx".

However, I feel this is a bug in the .net framework. Why does it work for an hour before giving an exception? Anyone care to react?
grmAbay
Asp.Net User
Re: Dynamic control5/24/2004 8:59:52 AM

0/0

OK everyone, here's the solution, and as always, it's pretty easy, but as easily overlooked:

The path to the control was a string in theis format : "..//directory//usercontrol.ascx". Notice anything wrong?

THESE ARE NOT ESCAPE SEQUENCES!

It should be: "../directory/usercontrol.ascx".

However, I feel this is a bug in the .net framework. Why does it work for an hour before giving an exception? Anyone care to react?

Thanks to Tony for helping me out with this one.
16 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Structural Dynamic Systems Computational Techniques and Optimization: Dynamic Analysis and Control Techniques Authors: Cornelius T. Leondes, Pages: 324, Published: 1999
Control and Dynamic Systems: Advances in Theory and Applications Authors: Cornelius T. Leondes, Pages: 371, Published: 1980
Dynamic Control of Quality in Production-inventory Systems: Coordination and Optimization Authors: David D. Yao, Shaohui Zheng, Pages: 218, Published: 2002
Dynamic Programming and Optimal Control Authors: Dimitri P Bertsekas, Pages: 2, Published: 1995
Control and Dynamic Systems: Advances in Theory and Applications, Part 2 Authors: Cornelius T. Leondes, Pages: 318, Published: 1990
Control and Dynamic Systems: Advances in Theory and Applications Authors: Cornelius T. Leondes, Pages: 384, Published: 1978
Optimization Over Time: Dynamic Programming and Stochastic Control Authors: Peter Whittle, Pages: 0, Published: 1982
Control of Uncertain Dynamic Systems: A Collection of Papers Presented at the International Workshop on Robust Control, San Antonio, Texas, March 1991 Authors: Shankar P. Bhattacharyya, Lee H. Keel, Pages: 524, Published: 1991

Web:
Dynamic Control The most trusted name for ultimate sound and noise control. Acoustic solutions for car audio, hot rods and home theater. Dynamat is recognized by consumers ...
Dynamic Control : Home Specializes in manufacture and supply of off-the-shelf and custom tools for test engineers and technicians, with some focus on automotive testing and engine ...
Dynamic Control Systems Dynamic Control Systems provides custom controls for industry leaders nationwide .
2008 ASME DSCC Dynamic Systems and Control Conference DSCC-2008 Information for the 2008 Dynamic Systems and Control Conference.
BMW M3 Coupé : Dynamic Stability Control (DSC) Thanks to Dynamic Stability Control (DSC), the BMW M3 Coupé impresses with its stable handling even in critical situations.
MIT OpenCourseWare | Electrical Engineering and Computer Science ... 6.241 Dynamic Systems & Control. Fall 2003. Open loop feedback system. Open loop feedback system, with an input (r), output (y), and functions K(s) and P(s) ...
ASME : Dynamic Systems & Control Division - About DSCD Concentrates on control methods and devices, from servomechanisms and regulators to automatic controls, for dynamic systems involving forces, motion and/or ...
Journal of Dynamic Systems, Measurement, and Control Journal of Dynamic Systems, Measurement, and Control Cover. Editor:. Suhada Jayasuriya Texas A&M University. ISSN: 0022-0434. eISSN: 1528-9028 ...
Dynamic Layout Control Tutorial details:Written by: Jed Wood (usableFlash.com) Time: About 15 minutesDifficulty Level: IntermediateRequirements: Flash MXTopics Covered: Stage ...
Textbook: Dynamic Programming and Optimal Control The leading and most up-to-date textbook on the far-ranging algorithmic methododogy of Dynamic Programming, which can be used for optimal control, ...

Videos:
ACT pt1: dynamic control of effects, instrument, and mixing SONAR 6's innovative new Active Controller Technology™ will forever change the way you work with instruments, effects, and mixing. Hosted by Cakewalk...
ACT pt2: Dynamic Control of Effects, Instruments, and Mixing SONAR 6's innovative new Active Controller Technology™ will forever change the way you work with instruments, effects, and mixing. Hosted by Cakewalk...
Dynamic Control Systems Dynamic Control Systems is Providing Services in the Los Angeles,CA area.
Dynamic Deeds Media: dynamic control image upload tutorial The is a tutorial that explains how to add an image to your Dynamic Control website. More info: http://dynamicdeeds.com
ONLINE DRUM TUTORIAL #3: DYNAMIC CONTROL ~ MASTERING THE TABLES OF TIME 04/08 McNally Smith College of Music Masterclass, focusing on musical phrasing with Dynamic Control Studies, from Ch. 1 of MASTERING THE TABLES OF TI...
Technical Briefing Number 6 - Third and Fourth Dynamic Hats the people who are in power on the planet believe that if they could control what you think, then you are totally under control. And in actual fact, ...
Low g Inertial Sensors for Vehicle Dynamic Control Low g inertial sensors for vehicle dynamic control on display at Freescale Technology Forum 2008.
Boston Dynamics: LittleDog The Legged Learning Robot LittleDog is a quadruped robot for research on learning locomotion. Scientists at leading institutions use LittleDog to pr...
dynamic control: image upload The is a tutorial that explains how to add an image to your Dynamic Control website. More info: http://dynamicdeeds.com
Dynamic Control of Nonholonomic Wheeled Mobile Robot(1) Dynamic Control of Nonholonomic Wheeled Mobile Robot




Search This Site:










styles and dragablility

using ip address to access parent portal

textchanged blocks checkedchanged

linkstatus accessibility

webhost4life and missing images

is it possible???

solpart menu from database data

horizontal menu help

re: quick general question on namespaces for module development

copying database from the server

nhibernate serious problem

dotnetnuke database schema

problem adding an additional column to dataset

dnn copyright?!

push code from dev server to test server

how "per server" license type could be made

new to dnn and having errors with dnn 3.0.8

random forms authentication problem

light weight css menu alternative

dnn 3.0.13 hangs

logging application block: its it asynchronous?

can i create a form for input specific data, in dotnetnuke page?

preventing unauthorized downloading

force download of file

excel tries to help but make things dificult

impersonation

operation could destabilize the runtime

asp menu / dynamic navigation

buying visual studio for the first time.

master page content place holder changes shape

 
All Times Are GMT