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 7560381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:53:19+00:00 2026-05-30T12:53:19+00:00

In the Global.asax’s Application_Error() method in my MVC3 application, I have the following code

  • 0

In the Global.asax’s Application_Error() method in my MVC3 application, I have the following code to send out system error notifications:

    protected void Application_Error()
    {
        string ip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
        string userAgent = string.Empty;
        string currentPageUrl = "";
        if (Request.ServerVariables["HTTPS"].ToString() == "")
        {
            currentPageUrl = Request.ServerVariables["SERVER_PROTOCOL"].ToString().ToLower().Substring(0, 4).ToString() + "://" + Request.ServerVariables["SERVER_NAME"].ToString() + ":" + Request.ServerVariables["SERVER_PORT"].ToString() + Request.ServerVariables["SCRIPT_NAME"].ToString();
        }
        else
        {
            currentPageUrl = Request.ServerVariables["SERVER_PROTOCOL"].ToString().ToLower().Substring(0, 5).ToString() + "://" + Request.ServerVariables["SERVER_NAME"].ToString() + ":" + Request.ServerVariables["SERVER_PORT"].ToString() + Request.ServerVariables["SCRIPT_NAME"].ToString();
        } 

        if (!string.IsNullOrEmpty(ip))
        {
            string[] ipRange = ip.Split(',');
            string trueIP = ipRange[0];
        }
        else
        {
            ip = Request.ServerVariables["REMOTE_ADDR"];
        }

        string urlReferrer = string.Empty;

        try
        {
            urlReferrer = Request.UrlReferrer.ToString();
        }
        catch (Exception ex)
        {
            // do nothing
        }

        try
        {
            // get user Agent
            userAgent = System.Net.Dns.GetHostEntry(ip).HostName; //.GetHostByAddress(ip).HostName;

        }
        catch (Exception ex)
        {
            userAgent = Request.UserAgent;
            // do nothing
        }

        string userDetails = "IP Address: " + ip + 
                                "<br /><br />Url Referrer: " + urlReferrer
                                + "<br /><br />Current Page: " + currentPageUrl + "<br /><br />";


        try
        {
            Exception exception = Server.GetLastError();
            Response.Clear();


            Controllers.ControllerBaseClass.SendSystemNotification("System Error", userDetails + exception.Message + "<br /><br />" + exception.StackTrace);


        }
        catch (Exception ex)
        {
            Controllers.ControllerBaseClass.SendSystemNotification("System Error", userDetails + ex.Message + "<br /><br />" + ex.StackTrace);
        }

    }

So far it has been successfully sending notifications of mostly route errors when attempts like:

www.mysite.com/phpadmin/somephpfile.php

Since there’s no route matching that, a file not found exception is thrown. Fine.

The email sent contains the current page that was attempted which resides on my site, and associated text indicating that the controller path for ‘/[whatever invalid path]/’ was not found or does not implement IController.

Recently,however, I’ve been seeing attacks where the Current page does not exist on my server,

ie. www.etorrent.co.kr:80/js/filter.js

I’m curious as to why I’m not seeing the current page as that of one on my server, and if I need to add additional security features / missed something?

Thanks.

  • 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-30T12:53:21+00:00Added an answer on May 30, 2026 at 12:53 pm

    In hack attempts, the potential hacker will create a copy of your site/forms on their server and attempt to launch your processes from those locations. The URL Referrer captures the source of the originating request and that is what appears.

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

Sidebar

Related Questions

i have following RegisterRoutes method in global.asax of my web forms application` routes.MapPageRoute(about, about,
I have the Global.asax like the code below: public class MvcApplication : System.Web.HttpApplication {
I implemented a following code in Global.asax file of my web application. void Application_BeginRequest()
I have user global.asax and I have write this code in my ASP.NET application
In my Global.asax file, I have the following code that deals with with unhandled
I have the following code in my Global.asax file: Protected Sub Application_PreRequestHandlerExecute(sender As Object,
I have code in global.asax that sets some things in cache with CacheItemRemovedCallback. When
I have the following in my Global.asax.cs routes.MapRoute( Arrival, {partnerID}, new { controller =
I have a class Application that my global.asax inherits from. The class has this
In my Global.ASAX file i have the following: void Session_End(object sender, EventArgs e) {

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.