Strange problem with asp.net site

I have created an asp website and I have the following problems: -

I am using the master page in it and have defined two content holders, one of which is in the header, and I have specified the page title in the topmost directive in the @page directive, but the page title does not show up. I need to manually add a tag to it.

Secondly, when I create a content page from the master page, it creates it, and when I rename it, it doesn't rename it. It remains _Default, so every page has _default inheritance.

Most importantly I am using a page to enter and view data in a database. I used a boolean name isadmin

that I set according to the credentials on page load. and I will add a panel where the visible property is set to Visible = '<%#IsAdmin %>'

. It works correctly when I run it through the visual studio environment, but when I publish and run it, it doesn't work and the panel just comes in and stays there. Why is this happening? Any ideas? Thanks to

The visible issue is fixed as I had to enable Windows Authentication on the server. Waiting for answers on two other questions. Thanks to

0


a source to share


3 answers


  • Try adding <head runat=server>

    to your homepage. Only then can ASP.net "see" the tag and change it.
  • It's not too bad that multiple aspx pages have the same class names. ASP.NET 2.0 started to treat each page as its own compilation unit or so. Pages cannot see each other. There is a special directive for pages to look at each other and imperialize or manipulate them. Therefore, he should not harm.
  • Perhaps you haven't checked it correctly and are wrong that it works in Visual Studio ??? But anyway, I would suggest that you move your logic to OnInit, then it works much earlier. I think the control tree is created before Page.OnLoad. What you are doing is data binding which can only work when DataBind is called, I'm not sure if


Or use the safe way: create a property IsAdmin

so that it is initialized on first call and cache the result in a variable

+2


a source


Regarding question # 2 - add your content pages via Project β†’ Add New Item and name it accordingly. Thus, the naming is consistent and correct throughout.



As for # 3, what HTML is output when run from the server?

0


a source


Your first problem can be solved by filling in the header of the @Page directive in your .aspx pages. The home page will display this text in the title bar of browsers.

and prob # 2 needs to be solved by adding files using add file option in visual studio.

0


a source







All Articles