Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Share user control across applications

Reply
Thread Tools

Share user control across applications

 
 
mg
Guest
Posts: n/a
 
      12-18-2003

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



 
Reply With Quote
 
 
 
 
Kelly Leahy
Guest
Posts: n/a
 
      12-18-2003
>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
 
Reply With Quote
 
 
 
 
mg
Guest
Posts: n/a
 
      12-18-2003
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
>.
>

 
Reply With Quote
 
Kelly Leahy
Guest
Posts: n/a
 
      12-18-2003
>
>"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
 
Reply With Quote
 
James Radke
Guest
Posts: n/a
 
      12-19-2003
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" <(E-Mail Removed)> wrote in message
news:03dd01c3c5ac$ab016cf0$(E-Mail Removed)...
> >
> >"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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Share-Point-2010 ,Share-Point -2010 Training , Share-point-2010Hyderabad , Share-point-2010 Institute Saraswati lakki ASP .Net 0 01-06-2012 06:39 AM
Share data across web applications? Jason Barnett ASP .Net 1 01-21-2010 12:28 AM
Share User Control Across Applications - How? Chad A. Beckner ASP .Net 3 06-07-2004 08:43 PM
share aspx across web applications Jon Paugh ASP .Net 3 01-20-2004 10:03 PM
Share user control across applications mg ASP .Net 1 12-18-2003 11:44 PM



Advertisments