Share user control across applications

Discussion in 'ASP .Net Web Controls' started by mg, Dec 18, 2003.

  1. mg

    mg Guest

    I took the following steps to share a user control across
    applications but was unsuccessful.


    WebUserControl:

    <%@ Control Language="c#" AutoEventWireup="false"
    ClassName="WebUserControl1" %>

    -----------------------------------------

    WebUserControl.ascx placed in C:\Inetpub\Q

    -----------------------------------------

    In Internet Information Services:

    New / Virtual Directory

    Alias: Q
    Directory: C:\Inetpub\Q

    Properties: Remove Q

    -----------------------------------------

    WebForm:

    <%@ Register TagPrefix="HDR" TagName="Head"
    Src="Q/WebUserControl1.ascx" %>

    <%@ Page language="c#" Codebehind="WebFormASCX.aspx.cs"
    AutoEventWireup="false" Inherits="Deploy.WebFormASCX" %>


    Running the WebForm results in the following error message:


    Parser Error Message: Could not find a part of the
    path "c:\inetpub\wwwroot\Deploy\Q\WebUserControl1.ascx".

    -----------------------------------------

    Can you see my error?

    MG
     
    mg, Dec 18, 2003
    #1
    1. Advertising

  2. mg

    Kelly Leahy Guest

    >WebForm:
    >
    ><%@ Register TagPrefix="HDR" TagName="Head"
    >Src="Q/WebUserControl1.ascx" %>
    >
    ><%@ Page language="c#" Codebehind="WebFormASCX.aspx.cs"
    >AutoEventWireup="false" Inherits="Deploy.WebFormASCX" %>
    >
    >
    >Running the WebForm results in the following error

    message:
    >
    >
    >Parser Error Message: Could not find a part of the
    >path "c:\inetpub\wwwroot\Deploy\Q\WebUserControl1.ascx".
    >


    Perhaps the src attribute requires the "true" path (file
    system) rather than the URL path?

    Have you tried src = "../../Q/WebUserControl1.ascx"?

    Kelly
     
    Kelly Leahy, Dec 18, 2003
    #2
    1. Advertising

  3. mg

    mg Guest

    Kelly,

    Using src = "../../Q/WebUserControl1.ascx"

    lead to the following error message:

    "Cannot use a leading .. to exit above the top directory."

    and using src = "../Q/WebUserControl1.ascx"

    lead to the following error message:

    "The virtual path '/Q/WebUserControl1.ascx' maps to
    another application, which is not allowed."

    ??

    mg


    >-----Original Message-----
    >>WebForm:
    >>
    >><%@ Register TagPrefix="HDR" TagName="Head"
    >>Src="Q/WebUserControl1.ascx" %>
    >>
    >><%@ Page language="c#" Codebehind="WebFormASCX.aspx.cs"
    >>AutoEventWireup="false" Inherits="Deploy.WebFormASCX" %>
    >>
    >>
    >>Running the WebForm results in the following error

    >message:
    >>
    >>
    >>Parser Error Message: Could not find a part of the
    >>path "c:\inetpub\wwwroot\Deploy\Q\WebUserControl1.ascx".
    >>

    >
    >Perhaps the src attribute requires the "true" path (file
    >system) rather than the URL path?
    >
    >Have you tried src = "../../Q/WebUserControl1.ascx"?
    >
    >Kelly
    >.
    >
     
    mg, Dec 18, 2003
    #3
  4. mg

    Kelly Leahy Guest

    >
    >"The virtual path '/Q/WebUserControl1.ascx' maps to
    >another application, which is not allowed."


    I just found a line in a book I have (Building ASP.NET
    Server Controls by Dale Milchalk and Rob Cameron (pretty
    good book IMHO) - APress publishers) that says "Resusing
    a user control [.ascx] requires copying its .ascx files
    along with code-behind assemblies, if necessary, in order
    to reuse it in different web applications." (page 75).

    Sounds to me that you can't share it without doing copy-
    paste sharing...

    Kelly
     
    Kelly Leahy, Dec 18, 2003
    #4
  5. mg

    James Radke Guest

    Look into creating a Web Custom Control, then you can store the final
    resulting control in a DLL; and re-use it across applications (either by
    copying the DLL into the BIN directory of each application, or by installing
    in the GAC).

    This method also allows you to create/store client-side code (i.e.
    javascript) within the control's DLL and render to the page when loading the
    control.

    I have set up several, and I have created designers for them as well, so
    that they are now in my toolbox and I can just drag and drop them into a
    form, change the properties that I need to, compile and run the application.
    Works very nice.

    Doing a search on MSDN.MICROSOFT.COM will bring up articles with
    step-by-step guides. If you have trouble finding information, let me know.

    Is this what you were looking for?

    Thanks!

    Jim


    "Kelly Leahy" <> wrote in message
    news:03dd01c3c5ac$ab016cf0$...
    > >
    > >"The virtual path '/Q/WebUserControl1.ascx' maps to
    > >another application, which is not allowed."

    >
    > I just found a line in a book I have (Building ASP.NET
    > Server Controls by Dale Milchalk and Rob Cameron (pretty
    > good book IMHO) - APress publishers) that says "Resusing
    > a user control [.ascx] requires copying its .ascx files
    > along with code-behind assemblies, if necessary, in order
    > to reuse it in different web applications." (page 75).
    >
    > Sounds to me that you can't share it without doing copy-
    > paste sharing...
    >
    > Kelly
     
    James Radke, Dec 19, 2003
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mg
    Replies:
    1
    Views:
    469
    Hermit Dave
    Dec 18, 2003
  2. Jon Paugh

    share aspx across web applications

    Jon Paugh, Jan 20, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    475
    Chris Jackson
    Jan 20, 2004
  3. Chad A. Beckner

    Share User Control Across Applications - How?

    Chad A. Beckner, Jun 7, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    621
    John Saunders
    Jun 7, 2004
  4. Jason Barnett

    Share data across web applications?

    Jason Barnett, Jan 20, 2010, in forum: ASP .Net
    Replies:
    1
    Views:
    819
    Mr. Arnold
    Jan 21, 2010
  5. Saraswati lakki
    Replies:
    0
    Views:
    1,344
    Saraswati lakki
    Jan 6, 2012
Loading...

Share This Page