Solved

Question about the <script runat="server> tag to keep DW from modifying the @page directive for .NET applications

Posted on 2006-11-30
15
243 Views
Last Modified: 2010-04-03
Hi,

I feel a bit thick, but could someone please give me a little more insight into how this works?:

http://www.experts-exchange.com/Web/WebDevSoftware/DreamWeaver/Q_21576546.html?query=codeOutsideHTMLIsLocked+%3Cscript+runat%3D%22server%22%3E&topics=114

I'm having the same problems with DW modifying the @page directives for my .NET application, but I don't quite understand how the remedy works, or where exactly the tag goes.

Thanks
0
Comment
Question by:tmccrank
  • 7
  • 5
  • 3
15 Comments
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 18050824
Hi tmccrank,

DW allows code in templates that is outside of the HTML tag to be edited despite the template restrictions and the @page directive is being modified because DW is seeing a path there and is trying to rewrite all paths from the Templates directory to wherever.  There are a few things you can try.

1) Add the <script runat="server"></script> around the @page

2) Lock the code in the child pages by changing:

<!-- InstanceBegin template="/Templates/filename.dwt.asp" codeOutsideHTMLIsLocked="false" -->

to

<!-- InstanceBegin template="/Templates/filename.dwt.asp" codeOutsideHTMLIsLocked="true" -->

3) Chage the paths in the @page to full server paths (this works for PHP include problems in templates).

0
 
LVL 25

Expert Comment

by:Rouchie
ID: 18052151
This isn't my answer; more an opinion.  I was forced to move away from Dreamweaver because if its appalling support for .NET programming.
Microsoft have a free web page editor (downloadable from ASP.NET) that is superb, but lacks the layout design power of Dreamweaver.  I'd advise running this to actually code your pages, then when you've done, switch to Dreamweaver to provide the styling and layout.

Microsoft are actually releasing a new free product that smacks all over DW's functionality for the styling (and still allows the .NET coding).  I'm not sure how this affects their long-running "let's avoid each other's business share" behaviour.
0
 

Author Comment

by:tmccrank
ID: 18057055
Thanks for your answers.  

jason1178: I think I misunderstood your instructions to mean that each one was a possible solution in itself... so I tried adding just the <script runat="server"> tags around the @page directive.  Needless to say it didn't work, I had to go through and manually change a bunch of stuff again... :-|   So, if I get you right, I need to add the <script> tag as well as adding the <!-- InstanceBegin template="/Templates/filename.dwt.asp" codeOutsideHTMLIsLocked="false" --> bit?  I'm not working with PHP, so #3 shouldn't be much of an issue (I think).

Rouchie: frustrating, isn't it?  Any idea when the new free product is supposed to come out?
0
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 200 total points
ID: 18057244
Hi tmccrank,

No, each of those was a solution unto itself.  If #1 didn't work, undo it and try #2.  #3 was a solution that works for a similiar DW problem with PHP templates, so I figured it's worth a shot.

I don't normally do ASP.NET at all, so my answers are based on seeing other questions and answers here.  No guarantee that my answers are valid.

Rouchie, have you see this before with DW and ASP and is there a hack for it?  You know this platform way better than I do.
0
 
LVL 25

Assisted Solution

by:Rouchie
Rouchie earned 200 total points
ID: 18066926
I've not seen this happen before, so let's attack it one step at a time.  The first thing in the other post you linked to that doesn't seem totally correct is the way in which the codebehind file is linked to.  The person used this example:

  ...Codebehind="../publications.aspx.vb"...

but I would use the ASP.NET application path symbol instead of ".." to give a more secure link (in case the directory location of each one changes):

  ...Codebehind="~/publications.aspx.vb"...

Try replacing ".." with "~" at the start of any paths.

>> Any idea when the new free product is supposed to come out?

Beta download is available now, although interestingly enough on MS's web site "Free" has now become "Free Trial", so I don't know if they are planning to charge.
http://www.microsoft.com/products/expression/en/web_designer/default.mspx

>> so I tried adding just the <script runat="server"> tags around the @page directive

No this wouldn't work because the @Page directive contains information to make <script...> work, so <script...> always needs to come after @Page.
I don't really following the solution in the linked post.  Can you post the code of a child page and I'll have an educated guess at where to place the <script...> tags?
0
 

Author Comment

by:tmccrank
ID: 18071982
Rouchie: I agree that the @Page directive shown in the post I linked to looks strange.  Mine hasn't been giving me problems (other than when DW is modifying it), so I don't think that's a problem.  FYI, here is an @Page directive from one of my pages:

<%@ Page Language="vb" ContentType="text/html" CodeBehind="Feedback.aspx.vb" AutoEventWireup="false" Inherits="NurseEducationModules.Feedback" %>

Also, FWIW, it looks like the MS software you're talking about (Expression) is being offered as a 60 day free trial.  Looks interesting though.  I can't install it at the moment as I'm running Office 2007 Beta (a no-no with Expression).

I took out the <script runat="server"> tags.  I copy & pasted "<!-- InstanceBegin template="/Templates/filename.dwt.asp" codeOutsideHTMLIsLocked="true" -->" in the <head> portion of my template html as per Adobe (http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_16531).  After pasting it, two strange things happened:  1) I can no longer edit the tag in DW (it should have NEM.dwt as the filename instead of filename.dwt.asp); and 2) it keeps moving itself *in front* of the <head> tag.

I can freely edit the template file in VS.NET, so giving the tag the proper filename isn't a problem; however, it still stubbornly refuses to move inside the <head> tag.

When I try to apply the template to one of my pages, I'm confronted with this error: "
0
 

Author Comment

by:tmccrank
ID: 18072000
Sorry... acccidentally posted the last one before finishing...

The error I get is: "There is an error at line 4 of "(my template file path)": Unbalanced InstanceBegin tag.
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 18072033
>> "There is an error at line 4 of "(my template file path)": Unbalanced InstanceBegin tag.

Does the receiving page have DW Template markup in it before you apply the template?  That would account for that error.
0
 

Author Comment

by:tmccrank
ID: 18073036
Thanks jason1178.   I hate to say it, but I'm coming up with errors that appear when I try to update pages after modifying the template - that have little to do with my original question.

FWIW, I think that the following from the Adobe website I posted above should help those that are running into a similar problem with having the @Page directive altered:

--------------------------------------------------------------

1       Open the template file.
2       Type (or copy):

<!-- TemplateInfo codeOutsideHTMLIsLocked="true" -->

  into the head of the template file.
3       Save your changes. The change will propagate to the instances. Existing code will be locked and no additional code can be added to the region.

--------------------------------------------------------------

My problem is that most of my .aspx (.NET) pages are not updating.  All of the .html pages are updating fine.  Would anyone mind if I posted the code, or should I start another thread?

Thanks-
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 18073051
tmccrank,

I posted that at the very beginning.  Solution #2 :)

You may want to close this out and start a new thread.  Get more experts looking at it.  Try posting it in the ASP forums here...
0
 

Author Comment

by:tmccrank
ID: 18073197
Hi jason1178,

I did see that... I was running into problems with it though.  

This is what you posted: <!-- InstanceBegin template="/Templates/filename.dwt.asp" codeOutsideHTMLIsLocked="false" -->

This is what the Adobe site had: <!-- TemplateInfo codeOutsideHTMLIsLocked="true" -->, very similar, but less problematic for some reason.

Anyway, my issue now is that I can't test it because of these other problems I'm running into.  I'll start another thread.

Man, complicated stuff!  :-)
0
 

Author Comment

by:tmccrank
ID: 18086311
jason1178 - thanks for your help... is there a way that I can award you some points for your help up to now?
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 18087280
Yes, but you should split the points between myself and Rouchie:

http://www.experts-exchange.com/help.jsp#hs5

Read the "More than one expert helped..." section.

Jason
0
 
LVL 25

Expert Comment

by:Rouchie
ID: 18087859
Thanks Jason.
0
 

Author Comment

by:tmccrank
ID: 18088238
Absolutely right... thanks to both of you.  I'll just split the points as they are now.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
breathing space around footer 13 253
Remove LF from html text 5 413
Coldfusion CFMESSAGEBOX Passing Variables 6 93
Video Not Showing 8 91
For those who don't know, Adobe Dreamweaver is a popular commercial web editor that enables you to design, build and manage complex websites. The editor is a WYSIWYG (What You See Is What You Get) web editor, which means that you can create your web…
I still run into .cgi files every now and then. In some instances, I actually prefer the simplicity of a .cgi script to other options. Since I use DreamWeaver extensively, what I needed was a way to open .cgi scripts in Dreamweaver. And I wanted to …
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now