zoukankan      html  css  js  c++  java
  • ashx 折叠

    ashx 没有折叠

    在打开网站式项目时,使用ashx 时只有一个文件 Handler.ashx 没有对应的.cs 文件。 这时代码在里面是不能进行折叠的。 混合编码的原因?

    解决方法:

    ASHX does contain markup - there us a register directive on top, so it is not handler by VB editor but rather by ASPX/ASCX/ASMX editor. Here is how code feature show up in ASP.NET files: ASPX editor identify code regions and delegate processing of code regions to VB or C# editor. However, since code editor does not actually own the entire file as it does with pure vb or cs files, not all features can be mapped without significant architectural work in the IDE. Since cost of the change was high and only one file type does not provide option for code separation, dev time was invested in other areas.

    Having said that, here is a workaround. I believe ASHX works same way in the editor as ASMX. There is no default template for ASHX with code separation, but you can create one manually.

    1. Create a handler, say, Handler.ashx.

    2. Add App_Code folder to the site.

    3. Add a new class to the App_Code, name file Handler.ashx.cs.

    4. Cut all content except <% %> directive from ashx file and paste it to the new class file.

    5. Add CodeBehind="~/App_Code/Handler.ashx.cs" to the ASHX file directive.

  • 相关阅读:
    51Nod 1085 背包问题 (01背包)
    Hdu2602 Bone Collector (01背包)
    Hdu1241 Oil Deposits (DFS)
    问题 1462: [蓝桥杯][基础练习VIP]Huffuman树
    结果填空:最强团队
    算法提高 排列数 (全排列)
    和 (DFS)
    洛谷P1605 迷宫 (DFS)
    Poj1979 Red and Black (DFS)
    Poj2386 Lake Counting (DFS)
  • 原文地址:https://www.cnblogs.com/BinBinGo/p/11683719.html
Copyright © 2011-2022 走看看