Thanks for trying to help me.
I've created a new Page base class derived from Page, MyPage. Now I'm
deriving all my web pages from MyPage instead of Page. This works very well
so far.
Here's the code I've added to MyPage.cs:
public HostApp CurHostApp
{
get {return (HostApp)Session["HostApp"];}
set {if (value==null || value.Count==0) Session.Remove("HostApp");
else Session["HostApp"]=value;}
}
Due to the Session object referenced in this property, VS Web Form Designer
is not able to show me a design view anymore. So I need to know how to tell
if my code is executed from within VS Designer, so that I can comment out
the code like:
{
get {return VisualStudio.ViewedFromWithinDesigner ? null :
(HostApp)Session["HostApp"];}
}
Axel
---------------------
"Cowboy (Gregory A. Beamer) - MVP" <No************@comcast.netNoSpamM>
schrieb im Newsbeitrag
news:94**********************************@microsof t.com...
Add property? To ASPX page in a code section or in the CodeBehind? I have
added properties in CodeBehind without any problems, but have not tried in
the ASPX itself, so that is the only thing I know of to look at right now.
If you do not get a good direction, post some code so someone can attempt to
repro your steps.
---
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
***************************
Think Outside the Box!
***************************
"Axel Dahmen" wrote:
Hi,
after I've added a property to my web page I can't open it in Visual
Studio Designer anymore. I get the error message "File couldn't be opened in
Web Forms Designer. [...] enablesessionstate page directive required to use
Session object."
I see that Visual Studio Web Forms Designer seems to execute any
Property code when opening the page. But I don't want it to.
How can I check if my page is in design mode so that I can skip any
relevant code during working in Designer?
TIA,
Axel Dahmen