Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Multiple Inheritance Dilemma
Message
De
09/09/2005 12:33:01
 
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Environment:
C# 1.1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01047884
Message ID:
01048180
Vues:
32
Matt,

I thought you had said that the BasePath property was already defined in your login class. Didn't you say you only needed a way to cast your JdaUserLogin class so that you could access the property?

Here's what you need:
// First the Interface needs to be defined in your namespace somewhere:

public interface IMyInterface
{
    string BasePath
    {
        get;
        set;
    }
}

// Then, your two classes need to implement that Interface

public class JdaBusinessWebPage : mmBusinessWebPage, IMyInterface
{
   private string m_BasePath;

   public string BasePath
   {
       get { //whatever code you need for this}
       set { //whatever code you need for this}
   }
}

public class JdaUserLogin : mmBaseUserLogin, IMyInterface
{
   private string m_BasePath;

   public string BasePath
   {
       get { //whatever code you need for this}
       set { //whatever code you need for this}
   }
}

// Then, you can cast to the Interface to access the property

string MyBasePath = ((IMyInteface)this.Page).BasePath;
~~Bonnie

>I currently have the BasePath property defined in my base page class and I set it in OnLoad() event to be the full URL path to the root of my website (using Request.ServerVariables). Then I can build paths to different subfolders in my website no matter what server my sight is running on.
>
>I have not used Interfaces yet. Would I be able to access Request.ServerVariables in the get() method of my property if I were to define it in an Interface?
>
>Matt
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform