#DEBUG Preprocessor statements in ASPX page

前端 未结 8 1074
滥情空心
滥情空心 2020-12-29 22:09

I\'m trying to use a preprocessor directive in an ASPX page, but the page doesn\'t recognize it. Is this just something I can\'t do?

Background: I\'m trying to inclu

8条回答
  •  天涯浪人
    2020-12-29 22:43

    I tried to achieve this many ways over the years with out any success. After playing with asp.net mvc recently I got this idea. There is another possibility to keep it all in aspx page using invalid MIME types. In asp.net MVC, templates are loaded with invalid MIME types, so that the browser will not parse them. I followed the same pattern here; Wola! Success... You need one static function that gives you easy access to debug constraint.

     
    

    Ops.IsRelease() is Public Static Function which returns the debug constaraint

        Public Shared Function IsRelease() As Boolean
            Dim [release] = False
    #If Not debug Then
            [release]=True
    #End If
            Return [release]
        End Function
    

提交回复
热议问题