[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 268
  • Last Modified:

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

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
tmccrank
Asked:
tmccrank
  • 7
  • 5
  • 3
2 Solutions
 
Jason C. LevineNo oneCommented:
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
 
RouchieCommented:
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
 
tmccrankAuthor Commented:
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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Jason C. LevineNo oneCommented:
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
 
RouchieCommented:
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
 
tmccrankAuthor Commented:
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
 
tmccrankAuthor Commented:
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
 
Jason C. LevineNo oneCommented:
>> "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
 
tmccrankAuthor Commented:
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
 
Jason C. LevineNo oneCommented:
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
 
tmccrankAuthor Commented:
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
 
tmccrankAuthor Commented:
jason1178 - thanks for your help... is there a way that I can award you some points for your help up to now?
0
 
Jason C. LevineNo oneCommented:
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
 
RouchieCommented:
Thanks Jason.
0
 
tmccrankAuthor Commented:
Absolutely right... thanks to both of you.  I'll just split the points as they are now.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 7
  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now