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 7743641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:35:13+00:00 2026-06-01T09:35:13+00:00

When developing ASP.NET websites (using VB.NET web forms) – a lot of my time

  • 0

When developing ASP.NET websites (using VB.NET web forms) – a lot of my time is spend writing CSS files and they always seem to get messy (code duplication) and very long.

All I want to achieve is to be able to manipulate the CSS using VB.NET code in the following ways:

  • Use an integer variable to store my “golden” number 7 and use that for width, padding, margin etc where needed
  • Use string variables to store my “golden” hex color codes e.g. “#44C5F2” and use them for color, background-color, border-color etc. where needed
  • Use an integer variable to set the height of an element and have four child elements each with height: mynum / 4

I just want to use basic VB.net number and string manipulation in order to create a CSS file on the fly.

I understand that the end product – the CSS file shouldn’t change much – it should at most change on a daily basis otherwise caching couldn’t be used.

I also understand that I would lose Visual Studio CSS intellisense support but…

How do I achieve this?

Should I be using:

  • Generic handlers (ASHX)
  • ASP.NET Themes
  • ASP.NET Skins
  • Something else?

I just some pointers.

Any help is appreciated.

Thanks.

  • 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-06-01T09:35:14+00:00Added an answer on June 1, 2026 at 9:35 am

    I decided to go with a WebHandler (ASHX file) in the end:

    CssOnTheFly.ashx

    <%@ WebHandler Language="C#" Class="CssOnTheFly" CodeBehind="CssOnTheFly.ashx.cs" %>
    

    CssOnTheFly.ashx.cs

    using System;
    using System.Web;
    
    public class CssOnTheFly : IHttpHandler
    {
    
        private HttpResponse r;
    
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/css";
    
            r = context.Response;
    
            writeCss();
        }
    
        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    
        private void writeCss()
        {
            wl("body {");
            wl("height: 100%;");
            wl("}");
        }
    
        private void wl(string s)
        {
            r.Write(s + Environment.NewLine);
        }
    }
    

    Because I could create bespoke classes to generate CSS on the fly – so I have more flexibility.

    I think I need to use C# for this because VB.NET doesn’t really have multi-line string literals.

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

Sidebar

Related Questions

I'm developing a mobile oriented website using asp.net. This website will consume some web
We are developing a web application using asp.net and sql server. We are required
Using ASP.Net Am New to website development Currently am developing a web pages, when
I'm developing a asp.net webforms website using vb.net. In that list of files displayed
Over the past 6 months I've been developing web sites using asp.net. When I
I am developing a website using asp.net, So far so good. the functionality does
I'm developing an website using asp.net mvc with MySQL and I need to make
I have an asp.net c# website I'm developing with Visual Web Developer Express Edition
I am developing an ASP.NET MVC 2 web site, targeted for .NET Framework 4.0,
I am new to IOS development (currently, I'm developing websites in ASP.NET) and 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.