Assembly and code behind

G

Guest

I’m sorry to disturb you but I have a problem on .NET development, and I’m
need some help to resolve it if it’s possible.



I have an aspx page with src property (no dll for my web application, all
pages are JIT compiled on request), and I want link a assembly with the “srcâ€
attribute, like

<%@ Assembly Src=â€/MyWebApplication/Common/MyAssemblyClass.cs†%>

This class is included in a namespace.

When I try to using this namespace in the source of my web page, runtime
compilation invokes a error who tell me that the namespace or type doesn’t
exist in the class or the namespace.

I’ve read on net some examples of using Src property for Assembly directive,
but always with aspx page with code inside…

It is possible to use this process with aspx code in a separate file, and if
yes, how can I do?

Thanks for any help, and apologize for disturbing

Best regards,
DELESTRE Christophe
(e-mail address removed)
 
B

Brock Allen

Remove the Src directive and add Inherits="YourNamespace.YourClassName" and
make sure the DLL is in ~/bin
 
G

Guest

Hi,

Thanks for your respons, but i've no dll for my web application, all is in
code who's compile at execution.

Regards,
 
B

Brock Allen

Ah, ok, I understand now. I completely misread the entire question from your
first post.

What you'll need to do next is determine why your .cs file isn't compiling.
Do you have any more info from the error? What about the .cs file itself?
Do you know what line or method isn't compiling? Perhaps post some of it
and we can take a look?
 
G

Guest

Hi,

Yes i can put few lines of code to more explain what i need to do :)

first i have my aspx page with theses directives:
<%@ Import Namespace="Microsoft.MSCOM.MNP.Framework"%>
<%@ Assembly Name="MNP.Framework, Version=2.0.5.0, Culture=neutral,
PublicKeyToken=a75671c2b10b8543" %>
<%@ Assembly Src="/EUGA/Common/Translation.cs" %>
<%@ Import Namespace="EUGA.Framework.Translation" %>
<%@ Page language="c#" Codebehind="AdvancedSearch.aspx.cs"
Src="AdvancedSearch.aspx.cs" AutoEventWireup="false"
Inherits="EUGA.fr.AdvancedSearch" ValidateRequest="false"%>

As you can see i use a assembly directive with a source property, indicate
path to .cs file

This is a part of my .cs file:
namespace EUGA.Framework.Translation
{
/// <summary>
/// Translation class for EUGA Sites
/// </summary>
public class TranslationProcess
{
// Object for Translation
protected XmlDocument _xmlResource;
private HttpContext _context;
private string _page;

/// <summary>
/// constructor
/// </summary>
/// <param name="thd">thread</param>
/// <param name="pagename">page name</param>
/// <param name="pagename">culture info</param>
public TranslationProcess(Thread thd, string pagename, CultureInfo
cultureInfo)
{
....

and this a part of my aspx.cs code (which is not compiled in dll remind you
:)):
using System;
using System.Text;
using System.Collections;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Threading;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using EUGA.Framework;
using EUGA.Framework.DAL.Countries;
using EUGA.Framework.DAL.Regions;
using EUGA.Framework.DAL.Cities;
using EUGA.Framework.DAL.Organisations;
using EUGA.Framework.DAL.Purposes;
using EUGA.Framework.DAL.Employees;
using EUGA.Framework.DAL.Activities;
using EUGA.Framework.DAL.UserProfile;
//using EUGA.Framework.Localization;
using EUGA.Framework.Translation;

using Microsoft.MSCOM.MNP.Framework;

namespace EUGA.fr
{
/// <summary>
/// This page display forms to make a Grant's search
/// </summary>
public class AdvancedSearch : Microsoft.MSCOM.MNP.Framework.Page
{
....

When i try to display this page on IE, i have this error:
unable to found namespace or type in EUGA.Framework 'Translation'

it seems to not be able to link the assembly i've created in the .cs file

It's enough cleat for you or do you want more explain ?

If you prefer i can let u my work email : (e-mail address removed)

Great thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top