Results 1 to 7 of 7

Thread: [RESOLVED] PHP's include in ASP.NET

  1. #1

    Thread Starter
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Resolved [RESOLVED] PHP's include in ASP.NET

    Don't get bogged down by the title, as I am completely open to any suggestions.

    First off here is what I'm attempting to do:

    I want one page to have my authentication page. From there, I want a query string appended to the URL (just for example purposes. We are doing things a little more secure) and load a page from a secure directory.

    I'm attempting to make a system where all I need to do is drop a folder into our specific secured directory and then, with the appropriate query string added to the authentication page, it loads it up without having to add any additional code to the original page.

    I played a bit with Server.Transfer, but I read that it is classic ASP and there should be more robust ways in .NET and it keeps telling me the page isn't compiled when I try to reference one from another project.

    I also read about user controls, but it seems those only work within the same project and I would need to re-publish every time a change was made or a control was added.


    Does anyone have any suggestions on how to get this working or how to fix the Server.Transfer to work with files from other projects?

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

    Re: PHP's include in ASP.NET

    Server.Transfer is definitely alive and kicking within ASP.Net, and has it's uses.

    However, if I have understood you correctly, all you want to do is, when authentication is validated, you want to pass off execution to another page, not necessarily in your current project, but can be navigated to, and for it to do it's own processing based on the QueryString that you pass in.

    Does that just about cover it?

    If so, why not simply do a Response.Redirect to the page that you want to load up in the browser? At the time you do the Response.Redirect, you can append whatever you like onto the QueryString, and then have that page take the appropriate action.

    Now, moving onto the way that I would do it, given what you have described...

    I would use an ashx (an ASP.Net Handler) to handle all the requests for the files. In there, do the authorization to make sure that the person has access to those files, and if they have, make them available.

    Have a look here for an explanation, and demonstration:

    http://www.dotnetcurry.com/ShowArticle.aspx?ID=270

    Hope that helps!!

    Gary

  3. #3
    Frenzied Member brin351's Avatar
    Join Date
    Mar 2007
    Location
    Land Down Under
    Posts
    1,293

    Re: PHP's include in ASP.NET

    It sounds to me that you have a main website that is published (precompiled) on the server and need to add individual pages to this "directory" of the website that are not precompiled then refrence/show them - Is that right? If so I don't think you can do that under one website and hence your error.

    Before I ramble on let us know if Gary is on the right track or I am or neither of us
    The problem with computers is their nature is pure logic. Just once I'd like my computer to do something deluded.

  4. #4

    Thread Starter
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Re: PHP's include in ASP.NET

    Thanks to both of you for the responses.

    From the sounds of it, it seems like brin is closer to what I'm looking for. Maybe I'll try to break it down completely to make a little more sense incase there is an easier way to accomplish the entire thing.

    I have an authentication class for basic LTI (SSO from our LMS) and we have several widgets, as well as more that will be built as the system progresses.

    What I want to do is have all of those widgets have the authentication class in them (aka have it accessible to all of the widgets), preferably without having to publish them with duplicate code or multiple copies of a dll.

    I suppose the easiest way would be for me to ask if there is some global directory for ASP that I could put a DLL that would allow it to be referenced by all projects in the web directory without having to have it in each websites individual bin directory.

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

    Re: PHP's include in ASP.NET

    How about in the GAC?

    Gary

  6. #6

    Thread Starter
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Re: PHP's include in ASP.NET

    Sorry for the absence, this got put on the backburner and I just got back to it today.

    The GAC worked perfectly, thanks Gary!

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

    Re: [RESOLVED] PHP's include in ASP.NET

    Hey,

    Glad to hear that you got it working!

    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