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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:21:39+00:00 2026-05-18T10:21:39+00:00

I found an article on removing whitespace from my markup in ASP.NET MVC, however,

  • 0

I found an article on removing whitespace from my markup in ASP.NET MVC, however, when I use the code converter, the “function” is not properly converted

public class WhitespaceFilterAttribute : ActionFilterAttribute
    {

        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {

            var request = filterContext.HttpContext.Request;
            var response = filterContext.HttpContext.Response;

            response.Filter = new WhiteSpaceFilter(response.Filter, s =>
                    {
                        s = Regex.Replace(s, @"\s+", " ");
                        s = Regex.Replace(s, @"\s*\n\s*", "\n");
                        s = Regex.Replace(s, @"\s*\>\s*\<\s*", "><");
                        s = Regex.Replace(s, @"<!--(.*?)-->", "");   //Remove comments

                        // single-line doctype must be preserved 
                        var firstEndBracketPosition = s.IndexOf(">");
                        if (firstEndBracketPosition >= 0)
                        {
                            s = s.Remove(firstEndBracketPosition, 1);
                            s = s.Insert(firstEndBracketPosition, ">");
                        }
                        return s;
                    });

            }

    }

This is what gets generated by the Telerik code converter,

    Public Overrides Sub OnActionExecuting(ByVal filterContext As ActionExecutingContext)

        Dim request = filterContext.HttpContext.Request
        Dim response = filterContext.HttpContext.Response

        response.Filter = New WhiteSpaceFilter(response.Filter, Function(s) Do
        s = Regex.Replace(s, "\s+", " ")
        s = Regex.Replace(s, "\s*\n\s*", vbLf)
        s = Regex.Replace(s, "\s*\>\s*\<\s*", "><")
        s = Regex.Replace(s, "<!--(.*?)-->", "")
        'Remove comments 
        ' single-line doctype must be preserved 
        Dim firstEndBracketPosition = s.IndexOf(">")
        If firstEndBracketPosition >= 0 Then
            s = s.Remove(firstEndBracketPosition, 1)
            s = s.Insert(firstEndBracketPosition, ">")
        End If
        Return s
        End Function)

    End Sub

However the Function(s) Do is invalid. I don’t know how to pass a function as a parameter in a method.

  • 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-18T10:21:40+00:00Added an answer on May 18, 2026 at 10:21 am

    It is basically a lambda expression in c#. : http://msdn.microsoft.com/en-us/library/bb397687.aspx

    You need to look at how to do the same in VB.net : http://msdn.microsoft.com/en-us/library/bb531253.aspx

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

Sidebar

Related Questions

I found this article on how to manipulate the rendering sequence of asp.net controls.:
I found an article from 2008 discussing how to call Java code from MySQL
I started by googling and found the article How to write INSERT if NOT
I copied come text from a The Huffington Post article and found that the
I found this on net in google search and see article here: http://www.thatcssguy.com/limit-your-divs/ See
I found an article with an interesting piece of code: public class Employee {
I found this article about simple proxy server implemented in JAVA: http://www.java2s.com/Code/Java/Network-Protocol/Asimpleproxyserver.htm The code
Hi I have found an article on implementing OpenID on my C# site http://madskristensen.net/post/OpenID-implementation-in-Csharp-and-ASPNET.aspx
I found this article regarding Linq-to-SQL and SQL Server connection pooling: MSDN Blog From
I found an article on image processing from here: http://www.switchonthecode.com/tutorials/csharp-tutorial-image-editing-saving-cropping-and-resizing Everything works fine. 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.