Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4539508
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T14:57:22+00:00 2026-05-21T14:57:22+00:00

Hello i am currently developing a kind of wiki system for my school, this

  • 0

Hello i am currently developing a kind of wiki system for my school, this system uses sub domains to find what course the wiki belongs to. example math1.wiki.com will be the course Math 1.
Now all these wikis use the same database and are given a wiki id, to find what data to load.

Here is the code i use to find the wiki id.
Global.asax

    protected void Session_Start()
    {
        var database = new DataContext();
        IWikiRepository rep = new WikiRepository(database);
        IWikiService service = new WikiService(rep);

        var domain = HttpContext.Current.Request.Url.Authority;
        var port = "";
        if (domain.Contains(':'))
        {
            var tmp = domain.Split(':');
            domain = tmp[0];
            port = tmp[1];
        }
        var split = domain.Split('.');
        var subdomain = split[0];

     //   if (subdomain == "localhost")
     //       subdomain = "wiki1";

        var wiki = service.GetSite(subdomain);

        if (wiki == null)
        {
            Response.StatusCode = 404;
            return;
        }

        Session["CurrentWiki"] = wiki;
    }

This is all fine, but i want to make the mvc system send a 404 request if no wiki was found for the subdomain. But this can not only be done in session_start() as it only runs once per session i have therefor tryed using Application_BeginRequest, but sadly do i not have access to the sessions in the method.

Do any one know how i can implement this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T14:57:23+00:00Added an answer on May 21, 2026 at 2:57 pm

    why can’t you just make a custom function that you call at the start of the main page to determine if the wiki exists and if not, redirect/error page/whatever. If it’s a custom function, you can just recall it when necessary.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello i am currently developing a ASP.NET MVC 3 application that uses the new
Hello I currently have this code checking if a cookie exists, it works all
Hello I'm currently on Day 2 of Jeffrey Way's Codeigniter tutorial. In this screencast
Currently I am doing this: I have text that looks like: Hello ${user.name}, this
Hello I currently have this PHP Script <?php if($purchase_dates != FALSE){?> <?php foreach($purchase_dates as
Hello everyone i currently have this: import feedparser d = feedparser.parse('http://store.steampowered.com/feeds/news.xml') for i in
Hello to all jQuery enthusiasts and experts!! I currently use on a project this
So I currently have this code: (ns contact-form.core (:gen-class)) (def foo Hello World!) (defn
Hello I'm currently having an issue with a timer in a program I'm developing.
Hello all iPhone developers, I am developing an iPhone application. In this application i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.