Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Reflection Question
Message
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01452083
Message ID:
01452180
Views:
30
Ok, I figured that out.

I added a project called Crystal Reports. I removed the Crystal Report from my main project and added to the new project.

After spending 20 minutes resolving the completely ambigous and totally useless error message "It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level " that resulted from me having one too many web.config files, I now have a compiled application. The namespace of the new project is "crystal_reports",

So back to my original problem, I now added the code you gave me:
Assembly a = Assembly.Load("Crystal_Reports");
var x = a.CreateInstance("Crystal_Reports.AsmCumLTDetail");
and it errors on the first line with "Cannot find the file specified"

I am totaly lost here.







>Don't you have a solution (as in .NET solution :-})?
>If so add it there and add a reference to it in the Website......
>>I ask because I don't see an option to add a project.
>>
>>
>>>Yeah
>>>>By assembly yuo mean it's own project?
>>>>
>>>>
>>>>>One option: Put the class that you want to instantiate into a separate assembly. You could then fire it up using:
            Assembly a = Assembly.Load("AssemblyName");
>>>>>var x = a.CreateInstance("AssemblyName.ClassName");
Store the string representing AssemblyName.ClassName in the DB - parse out the assembly name for use in the first line.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>So is it possible to set this up at this point? So that I can use reflection?
>>>>>>
>>>>>>>Hi Viv,
>>>>>>>
>>>>>>>If you create a website without project files you do not get namespaces in the files. The aspx page will look like this:
>>>>>>>
>>>>>>>Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default"
>>>>>>>
>>>>>>>
>>>>>>>And the class will look like this:
>>>>>>>
>>>>>>>sing System;
>>>>>>>using System.Collections.Generic;
>>>>>>>using System.Linq;
>>>>>>>using System.Web;
>>>>>>>using System.Web.UI;
>>>>>>>using System.Web.UI.WebControls;
>>>>>>>
>>>>>>>public partial class _Default : System.Web.UI.Page 
>>>>>>>{
>>>>>>>    protected void Page_Load(object sender, EventArgs e)
>>>>>>>    {
>>>>>>>
>>>>>>>    }
>>>>>>>}
>>>>>>>
>>>>>>>
>>>>>>>That said, there is a namespace involved but much more tricky to deal with. I am assuming based on Kevins response he has a file based website and no project. Anyone know what the namespace actually is? Paul?
>>>>>>>Tim
>>>>>>>
>>>>>>>>>
>>>>>>>>>I think so. It's an ASP.Net app and there are only 3 pages and the report. I thought I read somewhere that I needed to include
>>>>>>>>>the namespace, but I don't see any namespaces in a web app.
>>>>>>>>
>>>>>>>>There's always a namespace (unless you deliberately removed it). In the ASPX page you can see it in the Inherits attribute of the Page. Or, of course, in rhe aspx.cs file......
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform