Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6056655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:24:04+00:00 2026-05-23T08:24:04+00:00

I am using OpenRasta 2.0, and am hosting within a console application. I would

  • 0

I am using OpenRasta 2.0, and am hosting within a console application.

I would like to be able to return some static HTML pages and JavaScript files from this setup, for example:
/index.html
/jquery.js

The files are entirely static, i.e. no Handler or Resource is required.

I have added the appropriate files to the project, and initially tried the following syntax:

ResourceSpace.Has
.ResourcesOfType<object>()
.AtUri("/")
.HandledBy<HtmlHandler>()
.RenderedByAspx("~/Views/IndexView.aspx");

The .aspx file is added to the project under a folder ‘Views’, and is set the build action to ‘Embedded Resource’. This results in a NullReferenceException at runtime when attempting to resolve the virtual path. If I set the build action of the file to ‘Compile’, then it will not compile, I’m guessing because the console project does not understand ASPX.

I have also tried the following shorthand syntax for this available if referencing the WebForms codec:

ResourceSpace.Has
.TheUri("/jquery.js")
.ForThePage("~/Views/jquery.js");

But this suffers from the same issues as my initial approach, although does remove the need for a dummy Handler. So as far as I can tell, the WebForms codec cannot be used within a console application because the ASPX files cannot be compiled.

I was able to return HTML using the Razor codec as this expects the view templates to be embedded. However – I was not able to return a JavaScript file with the appropriate media type using the same technique, and I had to turn my otherwise static files into .cshtml files with a @resource defined.

I can’t find any examples online of returning static HTML and/or JavaScript using OpenRasta. I would expect to find a dedicated configuration API for this like the “TheUri” syntax but independent of the WebForms codec.

I could create my own ‘EmbeddedFileHandler’ to return the content of a static embedded file, but I feel like I’m missing something since this is such a simple use case…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:24:04+00:00Added an answer on May 23, 2026 at 8:24 am

    Anything that depends on the asp.net pipeline being initialized (such as aspx webforms pages) cannot compile because the BuildProvider is not there to do it, mostly because webforms is too tightly coupled to the asp.net pipeline.

    OR 2 was not really designed to be used as a full web stack outside of asp.net for serving static content, as usually the host environment is better suited at doing it, but that’s definitly something we’re going to address in 3.0.

    What I’d suggest is something along the lines of registering FileInfo as a resource, create a handler that can scan the file system for the files you want, and provide your own codec that either stream the data itself or call the API for the host http listener. It should be about 20 lines of code tops and would make a great blog post. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to implement file upload in RESTful way using openrasta but not able
I am using Open Rasta 2.0 under IIS 6. I would like to redirect
Using Rails 3.2.0 with haml and sass: I Would like to link an external
I'm trying to post some files using OpenRasta. I've gotten as far as getting
I'm using OpenRasta 2.0.3214.437 in an ASP.NET 4 web application. I'm registering a custom
(I'm also asking this on the OpenRasta google group) Hey all, I've been using
Using C# .NET 3.5 and WCF, I'm trying to write out some of the
Using JDeveloper , I started developing a set of web pages for a project
Using the navigator.geolocation object in JavaScript. Trying to establish accurate ranges, but wondering exactly
Would anyone be able to give me a quick pointer as to how I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.