Results 1 to 13 of 13

Thread: Include Pages

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2009
    Location
    Milan
    Posts
    810

    Include Pages

    I know in PHP you can do


    Code:
    require('page1.php');

    How can you do this in aspx?

  2. #2
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Include Pages

    Hello,

    There are a couple approaches that you could use.

    For instance, you could use ASP.Net User Controls, or you can use ASP.Net Master Pages.

    Gary

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2009
    Location
    Milan
    Posts
    810

    Re: Include Pages

    okay what i have is index.aspx I want to write a script which says if logged in via response.Cookie.... then show a login script otherwise show me the index.php page.

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2009
    Location
    Milan
    Posts
    810

    Re: Include Pages

    what is the better approach to take?

  5. #5
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Include Pages

    Are you using the built in ASP.Net Membership Provider?

    If so, then the best approach would be to use a LoginView control. You say you want to show index.php, if that is the case, why are you using ASP.Net? I am not saying that you "can't" do this, but mixing two very different technologies is likely to cause you other problems down the line.

    Gary

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2009
    Location
    Milan
    Posts
    810

    Re: Include Pages

    I think you might have missed my question.

    I don't want to write this in PHP, I want a ASPX copy of it.

    In my index.aspx.vb code I can use VB and check if I cookie exists, if it does not the redirect to login.aspx

    On these pages though I want a code to show menu links IF i'm logged in.

    So in PHP I would write

    Code:
    if ($_COOKIE['LoggedIn'] == True){
      echo "menui 1"; 
      echo "menu 2";
    }
    How can I write something in ASP which is the same as the PHP code but in ASP.NET?

  7. #7
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Include Pages

    Hello,

    Nope I don't think I missed the question, but I think you might have missed my response

    Everything that you have described can be achieved out of the box, if you use the built in systems that ASP.Net provides for you. Namely, the ASP.Net Membership, Roles and Profile Providers, along with the built in controls that ship with ASP.Net, such as the LoginView. Now granted, you "could" do all of this work by hand, using similar techniques to those that you used in PHP, but my question would be, why bother?

    IMO, it would be much more expedient to use the methods that have been tried and test within ASP.Net.

    Gary

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2009
    Location
    Milan
    Posts
    810

    Re: Include Pages

    Thanks, okay I understand what you are saying and let me explain my position.

    I've created a number a "sites" using Web Developer 2008 at working using our internal Intranet - I always get errors with it. How can I test or get the settings of my server so I can build something here at home and know i'm not wasting my time?

    Here is my background, I'm a PHP programmer but have basic VB.Net understanding.

    I want to build a site (mainly a subsite) on our internal intranet which connects to a database so we can edit, update and delete info.

    WHat is this .net membership? what's this loginview? where can i get a quick understanding of all of this???

  9. #9
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Include Pages

    Quote Originally Posted by AirlineSim View Post
    I've created a number a "sites" using Web Developer 2008 at working using our internal Intranet - I always get errors with it. How can I test or get the settings of my server so I can build something here at home and know i'm not wasting my time?
    What sort of errors are you referring to? Can you provide an example? Assuming that you are debugging/building straight out of Visual Studio, there should be no need to configure the server (assuming IIS) at this stage.

    Quote Originally Posted by AirlineSim View Post
    WHat is this .net membership? what's this loginview? where can i get a quick understanding of all of this???
    The short answer is Google/Bing. Here are a couple links that turned up after a quick search:

    Membership
    http://msdn.microsoft.com/en-us/library/yh26yfzy.aspx
    http://msdn.microsoft.com/en-us/library/ff648345.aspx

    LoginView
    http://msdn.microsoft.com/en-us/libr...loginview.aspx
    http://msdn.microsoft.com/en-us/library/ms178329.aspx

    Although the MSDN documentation can appear a bit daunting to start with, it really is the best place to get started.

    Gary

  10. #10

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2009
    Location
    Milan
    Posts
    810

    Re: Include Pages

    I would need to look tomorrow at work but the error around authentication, windows, Password, none etc when i remove it i get the topic 657156 which I created on this forum

    http://www.vbforums.com/showthread.php?t=657156

  11. #11
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Include Pages

    With regard to your other thread, are you able to provide more information, as requested? i.e are you running under IIS? If so, do you have the correct version of the .Net Framework etc installed?

    Gary

  12. #12

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2009
    Location
    Milan
    Posts
    810

    Re: Include Pages

    Quote Originally Posted by gep13 View Post
    With regard to your other thread, are you able to provide more information, as requested? i.e are you running under IIS? If so, do you have the correct version of the .Net Framework etc installed?

    Gary
    I'm not sure, I only have access to some foldes on the server. It's a major corperate server and we have restricted access.

    How can I test this?

    I tried running it under .NET 2.0 but got the same errors

  13. #13
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Include Pages

    Rather than continue the discussion about this issue in this thread, lets stick to talking about it in the other thread.

    Gary

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width