Custom file extension config in VS

I’m working on a new project that for marketing purposes doesn’t use the .aspx extension for webpages but an alternate extension. These pages work fine but they are definitely harder to develop with in their current configuration. There is one configuration procedure I found online which allowed me to associate the file type with the appropriate page editor in VS. However, I’m still having a couple issues, and I’m hoping someone knows a workaround.

When I’m in the page, Intellisense works fine. When I’m in the code behind, Intellisense works fine. However, when I try to write something in the code behind which references the webpage (like “txtSearch.Text”) Intellisense doesn’t understand that the webpage objects are part of the partial class. The partial class name in the code behind matches the inherits attribute. The codefile attribute references the correct code behind. However, Intellisense can’t find those objects.

The @Page directive has an error message and squiggly underline which is probably related, "ASP.NET runtime error: Could not load file or assembly ‘blahblahblah’ or one of its dependencies. Failed to grant minimum permission requests. However, everything I’ve found on the internet about this relates to missing .dll files, lost assembly references, etc. So I guess it will come as no surprise that none of those techniques has worked for my custom file extension situation.

In Solution Explorer, code behind files are not nesting beneath their webpages, so we’re looking at twice as many files as you would normally expect. I would really like to clean up that behavior.

Wouldn’t it be easier to develop the application as you usually would (with default extensions) and rewriting when in production?

Something like this? (of the top of my head and not tested)

<rule name="Extension  Rewrite" stopProcessing="true">
          <match url="(.*)\\.ext" />
          <action type="Rewrite" url="{R:1}.aspx" />

Rewrite is really the way to go here.

The ASPX editor seems to do that a bit when it is having a bad day, its the run back to momma behavior I think. I learned back in the dark ages of VS2002 or 2003 where, if you were doing anything interesting HTML-wise, your editor always through things were broken. Even had to go as far as disabling all the designer features to keep it from killing things. Fun times.