Session Variables or Cookies in Custom Server control

C

Charles Zhang

I created a custom server control whose rendering logic relies on
session variables and cookies. It works just fine at run time. The
problem is at the design time, because session variables and cookies are
not available, so that I get error messages. I just wonder if there are
any way such as conditional compile options to overcome the problem? Thanks

Charles Zhang
 
G

Guest

Howdy,

I 'm afraid you can't. this is not proper way of coding custom server
controls - provide properties instead that can be set from any type of data
medium.

Hope this helps
 
S

Steven Cheng[MSFT]

Hello Charles,

As Milosz has mentioned, so far there hasn't a means for us to seamlessly
make our custom webserver control's rendering code work 100% correctly at
both design-time and runtime. Especially when you access some runtime
specific or design-time specific states or data in your control's rendering
code.

Actually, for custom webserver control, we recommend that our control's
rendering code(control creation code logic) dedicated to runtime features.
For design-time specific presentation, you create a custom controldeisgner
for your custom control and override the "GetDesignTimeHtml" to output the
html content which will be displayed in designer surface. here are some web
article and msdn reference about using custom designer for web server
control:

#Custom Control Designers : Design-time HTML
http://aspalliance.com/articleViewer.aspx?aId=436&pId=

#ASP.NET Control Designers Overview
http://msdn2.microsoft.com/en-us/library/wxh45wzs.aspx

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================



This posting is provided "AS IS" with no warranties, and confers no rights.
 
C

Charles Zhang

Thank you very much for the points. I think I can find my own way to
work out the problem.

Charles Zhang
 
S

Steven Cheng[MSFT]

Thanks for the reply Charles,

Please feel free to post here if there is anything else we can help.


Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top