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

  • SEARCH
  • Home
  • 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 950351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:33:05+00:00 2026-05-15T23:33:05+00:00

Could some one give a simple example of creating a simple class with a

  • 0

Could some one give a simple example of creating a simple class with a simple method and calling the method from cshtml file in webmatrix?

I am trying to figure out if WebMatrix could be used in an object oriented way that would allow me to take advantage of the razor sytax as a view engine alternative to the MVC framework that I could use in combination with webforms applications. Having the power and productivity of webforms on the back-end and razor on the public facing pages would be really awesome.

I have very limited knowledge of asp.net but WebMatrix intrigues me but I don’t think the full inline approach is the right way to go.

Thank you!

  • 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-15T23:33:06+00:00Added an answer on May 15, 2026 at 11:33 pm

    Just put a .cs file in App_Code with something like this…

    public class Something {
        public void DoIt() {
        }
    }
    

    Then in a .cshtml file just call…

    var something = new Something();
    something.DoIt();
    

    You could also just make it static and call Something.DoIt directly.

    Hope that helps.

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

Sidebar

Related Questions

Could someone please give me simple websocket code. I am creating websocket example but
Could some one give me pointers to tutorials that explains how to write a
Dear Stackoverflow user, Could anyone give me an simple example of restful webservice with
Could someone give me a little direction on creating crossfades/dissolves between two UIImageViews in
Could someone give me an example of how to use the ContactPicker.PickSingleContactAsync() functionality correctly
Could some one guide me to create a APS logon token in .Net programmatically?
Iam getting the following error , could some one help me how to fix
Possible Duplicate: Javascript closure inside loops - simple practical example Calling setTimeout function within
I’ve been trying to transform some simple XML into another simple XML using XSLT.
could someone give me a brief explanation of what is happening differently in the

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.