embedded resources

C

Chuck

I have a class library.
Is it possible to embed an aspx file in it and have any embedded code/script
run?

Is there a way to do a Server.Transfer with an embedded resource?

thanks,
 
G

gerry

sure - look into Virtual Path Provider

I setup a 'site builder' web site where pretty much everything that can be
is compiled into .dll's including .aspx & .ascx files
 
A

Allen Chen [MSFT]

Hi,
I have a class library.
Is it possible to embed an aspx file in it and have any embedded code/script
run?
Is there a way to do a Server.Transfer with an embedded resource?

I believe Gerry's answer is correct. You can refer to the following article
to learn how to use Virtual Path Provider:

http://www.codeproject.com/KB/aspnet/ASP2UserControlLibrary.aspx?msg=2940045

If you need further assistance, please don't hesitate to let me know. I'll
do my best to follow up.

Regards,
Allen Chen
Microsoft Online Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
C

Chuck

I've never used a Virtual Path Provider before so here goes:

I am in an HttpModule and I create the virtual page.
However, I really don't know what to do from there.
I thought I could stop after ProcessRequest but nothing happens.
I am in an Ajax Partial Rendering state (IsInAsyncPostBack).
So I tried Server.Transfer but that didn't work either.

System.Web.UI.Page page = _application.Context.CurrentHandler as
System.Web.UI.Page;

System.Web.UI.ScriptManager mgr =
System.Web.UI.ScriptManager.GetCurrent(page);

if (mgr != null && mgr.IsInAsyncPostBack)
{
HttpContext.Current.Response.Clear();
IHttpHandler virtualPage =
(Page)System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath("~/App_Resource/Util.dll/"
+ "Util.ExceptionHandler.ExceptionViewer.aspx", typeof(Page));

virtualPage.ProcessRequest(HttpContext.Current);

page.Server.Transfer(virtualPage, false);
}
 
A

Allen Chen [MSFT]

Hi,
I thought I could stop after ProcessRequest but nothing happens.
I am in an Ajax Partial Rendering state (IsInAsyncPostBack).
So I tried Server.Transfer but that didn't work either.

Server.Transfer, in most cases, will not work if you call it in async
postback (please see my reply in you another post).
Virtual Path Provider is usually used to provide aspx code. Normally say we
request "http://server/A/default.aspx", the request is handled by a
HttpHandler. In this case, you can either precomplie the dll so that all
the handler's code persists in dll, or you can put partial code in aspx
file for later update. The code in aspx will be compiled along with the
partial code in dll to create a complete dll at run time.

With the help of Virtual Path Provider we have more flexibility. For
example, we can store aspx code in database, etc.

I reread your original post. Probably, what you need is custom control.

If you want to embed scripts please refer to the following sample:

http://cid-2fa13ebc6cc8e80f.skydrive.live.com/self.aspx/Public/RegisterClien
tScriptResource%7C_lvl%7C_300.zip

Regards,
Allen Chen
Microsoft Online Support
 
A

Allen Chen [MSFT]

Hi,
I thought I could stop after ProcessRequest but nothing happens.
I am in an Ajax Partial Rendering state (IsInAsyncPostBack).
So I tried Server.Transfer but that didn't work either.'

Have you solved this issue?

Regards,
Allen Chen
Microsoft Online Support
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top