CodingASP.NET horrors

 

Press Ctrl+Enter to quickly submit your post
Quick Reply  
 
 
  
 From:  Ally  
 To:  ALL
35588.1 
Right, so. I've started at mah new job, and finally had the chance to look through the code the runs the site. It's ASP.NET, but written like Classic ASP (no codebehinds, lots of <% %>ing)... we're all working through rewriting it to be, you know, good- but that takes time. I have a more urgent issue. Some preamble!

Going along with the "like Classic ASP" motif, there are a lot of include files used. One of which uses Response.Write to dump a load of javascript into the page, which sit above the DOCTYPE- i.e. it's rendering in Quirks Mode and making my life not worth living.

My actual question! Can I have two Page_Load voids? I assume not- that one would over-write the other or it'd just error out, but this include is used all over the place- I need to find a way of tying it into the page loading chain without overwriting anything.
0/0
 Reply   Quote More 

 From:  THERE IS NO GOD BUT (RENDLE)  
 To:  Ally     
35588.2 In reply to 35588.1 
Can you rewrite the included file to dump the Javascript into the ClientScriptManager instead of writing it to Response.Write?

0/0
 Reply   Quote More 

 From:  Ally  
 To:  THERE IS NO GOD BUT (RENDLE)     
35588.3 In reply to 35588.2 

Well, yes and no. The include is being processed before any Page object exists, so any attempt at registering anything fails miserably. However, I've ended up putting a Literal into the include, and then running the code on the Literal's OnLoad, so the Page object actually exists and all that.

 

Utterly hackish, but it'll work until we get the time to redo the whole bloody thing.

0/0
 Reply   Quote More 

 From:  Ally  
 To:  THERE IS NO GOD BUT (RENDLE)     
35588.4 In reply to 35588.2 

Oh, but I have another question.

 

Right now I'm having to build my solution every time I want to test anything in the codebehind- I've never had to do that before, just changing the .cs file is enough. Having to recompile every time is a pain- is there some setting change I need to do, or am I screwed?

0/0
 Reply   Quote More 

 From:  THERE IS NO GOD BUT (RENDLE)  
 To:  Ally     
35588.5 In reply to 35588.4 
If you change "codebehind" to "codefile" it'll run from the cs instead of the DLL. It caused me a lot of shit, though; I ended up going back to codebehind.

0/0
 Reply   Quote More 

 From:  THERE IS NO GOD BUT (RENDLE)  
 To:  Ally     
35588.6 In reply to 35588.4 
Or, write the code in stand-alone testable units, like you ought to be anyway.

0/0
 Reply   Quote More 

 From:  Ally  
 To:  THERE IS NO GOD BUT (RENDLE)     
35588.7 In reply to 35588.6 
There are many things that ought to be done, sadly. Cheers, though!
0/0
 Reply   Quote More 

Reply to All    
 

1–7

Rate my interest:

Adjust text size : Smaller 10 Larger

Beehive Forum 1.5.2 |  FAQ |  Docs |  Support |  Donate! ©2002 - 2024 Project Beehive Forum

Forum Stats