Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How is it possible that after a certain time limit code itself changes and remove all the controls from the page and leave a message only ? It is happening to a website ,website is on a dedicated server. please help me out.
Posted
Updated 6-Nov-12 7:05am
v2

1 solution

Self-modified code? Theoretically speaking, this is possible, but this is extremely complex (not only on .NET), so I don't want even to discuss it; but I'll mention in brief: you could create separate Application Domain, in this Domain create and load a whole assembly ether using System.Reflection.Emit (and in this case you also should know MSIL pretty well) or generate the code and compile it using CodeDOM, work with this Domain through IPC, and, when you need to do it again, unload the whole Application Domain and create a new one. How many of those concepts are you confident with? It will require very good knowledge and confidence in all of these topics, and also debugging is pretty difficult.

However, I think you don't need all these esoteric stuff right now, which is uses in some rare and really advanced cases. I rather think your question is based on misconceptions about very basic and simple programming principles. All the modern programming paradigms are based on stored and read-only code, separation between code and data, etc. It goes back to history as far as the Turing machine, which was not yes a stored-program computer.

Please see:
http://en.wikipedia.org/wiki/Turing_machine[^],
http://en.wikipedia.org/wiki/Stored-program_computer[^].

See also:
http://en.wikipedia.org/wiki/Self-modifying_code[^].

Nevertheless, if we go to mainstream programming, there a fields where modification or generation of code is widely used, but usually this is not a true self-modified code (which is, again, is discouraged). In particular, it happens in ASP.NET and other Web technologies. But this is completely different thing, because generating and generated codes work on the Web on different levels and different tiers. In brief, the server-side code responds to HTTP request and sends an HTTP response with some document like HTTP (most typically), which may contain JavaScript code which is then is executed on client side. This simple mechanism is often misunderstood by CodeProject inquirers who ask how to call JavaScript code by in C#/VB.NET code and visa versa. Strictly speaking, it makes no sense.

First of all, I doubt you really need the timer. You need to explain what effect do you expect and, importantly, why.

It's hard to understand what exactly you are trying to achieve, but I can suggest that it can be done using regular and usual ASP.NET and JavaScript techniques which you simply need to learn. Perhaps after that you will be able to ask more specific questions.

—SA
 
Share this answer
 
v3
Comments
Asp_Learner 6-Nov-12 13:34pm    
actually ,it is happening after a certain date ,every time I again put the source code then after sometime ,it again vanishes.
Asp_Learner 6-Nov-12 13:36pm    
there may be something done on iis ,as it is happening to dedicated server only ,when I try the same code shared paid server ,it is running without any problem
Sergey Alexandrovich Kryukov 6-Nov-12 13:52pm    
Happening... what?
--SA
Asp_Learner 7-Nov-12 3:46am    
Hey ,I have noticed ,actual problem is that ,its modifying ,its being replaced by a aspx page with same name ,have only text line of error ,as when I changed the name of file ,and waited for sometime ,after sometime it again created a error message file of previous name ,and my newly named file is safe now .PLease reply Sergey Alexandrovich Kryukov
Sergey Alexandrovich Kryukov 7-Nov-12 12:42pm    
Sorry, I cannot understand anything. Could you spend time and explain everything very clearly.
Besides, do yourself a great favor: move all you punctuation one position left, before blank space characters, never after. Honestly, reading your text is just painful.

(Should be: "Hey, I have noticed, actual problem is that, its...")
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900