xeroxero,
The first two are simple:
Page.MaintainSc rollPositionOnP ostBack = true;
Page.Title = "hello";
The page ViewStateEncryp tionMode property complains with an exception if you
try to set it manually: "The 'ViewStateEncry ptionMode' property can only be
set in the page directive or in the <pagesconfigura tion section"
Probably for security reasons, if a page has been configured to require
encrypted viewstate... well... allowing the code to change this would be
incorrect (given that the declaritive security requirements should override
requirements expressed in code). So... you're out of luck there.
However there is the "RegisterRequir esViewStateEncr yption()"... which will
force the veiwstate to be encrypted. This must be done in prerender or
before.
As to LinePramas... I think you're out of luck. LinePragmas is more of an
instruction to the ASP.NET compiler (the one that produces pure C#/VB.NET
code that is then compiled by .net). By the time your code is running...
it's already way too late (code has been generated and compiled).
Regards,
Rob MacFadyen
"xeroxero" <xe******@newsg roups.nospam wrote in message
news:kr******** *************** *********@4ax.c om...
>
I would like to set the following Page directives in my C# code-behind
for ASP.NET 2.0 Web Application Project and also in a ASP.NET 2.0 Web
Site. What event should I hook and what should the code look like?
MaintainScrollP ositionOnPostba ck
ViewStateEncryp tionMode
LinePragmas
Title
Thanks.