Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Cannot insert html snippets in .aspx files

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
pjhunter Posted - Jan 24 2024 : 4:47:08 PM
I have a VB project in VS2022. I've enabled VB support and can insert snippets in my code-behind files. However, I would like to insert snippets in the .aspx file, but can't seem to see a way to do that. The "Insert VA Snippet" command is disabled.

I've created a snippet in VA under the html language category. It just appears that VA does not recognize .aspx as an html file.

How can I make this work??
Thanks.
5   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Jan 29 2024 : 09:35:50 AM
Thank you for the update, this was a new approach for me, so I am glad to see that it works well

Adding support from extra file extensions, especially when the IDE is already doing some handling of them, isn't always quick or easy, so this isn't really something we are looking to do at the moment. So I am glad we have a useable workaround.
pjhunter Posted - Jan 26 2024 : 11:28:43 PM
Great! I just tried this and it works perfectly. I created a new aspx file (PayStubManager.aspx) and then I used your mklink suggestion as follows:

mklink /H PayStubManager.html PayStubManager.aspx

I then, in VS2022, added an existing item (PayStubManager.html) to my project. Giving it the same name it is easily locatable next to the actual aspx file. I then opened the html version, inserted my snippet, made the specified substitutions and then saved and closed the file and opened the .aspx file and everything was there. Perfect, with little added work.

It would be nice is Whole Tomato would recognize .aspx file directly, but this is a great work-around.

Thank you.
feline Posted - Jan 26 2024 : 08:30:14 AM
So far no luck making Visual Studio think that an ASPX file is a HTML file. I tried editing the VS2022 private registry file, and playing around with the extension settings, but I am not sure how they work in detail, so my simple edits aren't working.

But, I have thought of a possible work around. Assuming you don't have to many ASPX files, you can create a link (copy) of the ASPX file with a HTML extension. To do this, open a Windows command prompt, running as Administrator. Apparently you don't need to do this as Administrator under Windows 11, but I haven't double checked that.

Move the command prompt into the directory where the file lives, and then run the command:

mklink /H va_linked_aspx.html test_colour_and_font.aspx

obviously using the correct file names. The first file name is the NEW file that will be "created", while the second name is the existing file. Since this is a hard link at the file system level, any edit made to either file is made to the original file. So you can open and edit the ASPX file link, which VA will then treat as a HTML file, with your normal snippet support, and the IDE will see the original ASPX file being edited.

Just be aware there can be a lag before the ASPX file is updated in the IDE if you have both files open at the same time.

Not ideal, but perhaps a suitable work around.
pjhunter Posted - Jan 25 2024 : 1:05:55 PM
I'm willing to try. I can always set it back. Please send instructions.
feline Posted - Jan 25 2024 : 11:26:09 AM
I am seeing the same problem here. I tried changing the VA registry keys, to tell VA to treat ASPX files as HTML files, but that isn't enough. I suspect we would need to change the IDE settings as well, to tell the IDE to treat ASPX files as HTML files, but I am not sure if that is a good idea or not. I suspect it might break things on your end.

If you are interested in trying this, I can have a go, and see if I can get it to work, but I am wary of possible side effects.

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000