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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:22:40+00:00 2026-05-30T18:22:40+00:00

I have an application that contains a button, on click of this button, it

  • 0

I have an application that contains a button, on click of this button, it will open a browser window using a URL with querystring parameters (the url of a page that i am coding).

Is there a way to ensure that the URL is coming from my application and only from my application – and not just anyone typing the URL manually in a webbrowser?

If not, what is the best way to ensure that a specific URL is coming from a specific application – and not just manually entered in the address bar or a web browser-

Im using asp.net.

  • 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-30T18:22:41+00:00Added an answer on May 30, 2026 at 6:22 pm

    You can check if the request was made from one of the pages of your application using:

    Request.UrlReferrer.Contains("mywebsite.com")

    That’s the simple way.

    The secure way is to put a cookie on the client containing a value encrypted using a secure key or hashed using a secure salt. If the cookie is set to expire when the page is closed it should be impossible for someone to forge.

    Here’s an example:

    On the pages that would redirect to the page you are trying to protect:

      HttpCookie cookie = new HttpCookie("SecureCheck");
      //don't set the cookie's expiration so it's deleted when the browser is closed
      cookie.Value = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(Session.SessionID, "SHA1");
      Response.Cookies.Add(cookie);
    

    On the page you are trying to protect:

      //check to see if the cookie is there and it has the correct value
      if (string.IsNullOrEmpty(Request.Cookies["SecureCheck"]) || System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(Session.SessionID, "SHA1") != Request.Cookies["SecureCheck"])
        throw Exception("Invalid request. Please access this page only from the application.");
      //if we got this far the exception was not thrown and we are safe to continue
      //insert whatever code here
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a .NET application that contains a checkbox (System.Windows.Forms.Checkbox). This component (WindowsForms10.BUTTON.app.0.378734a1) is
I have an application widget that contains a button. Once I click the button,
I have this senario. We have an application server that contains a few web
I have a C# Windows Form application that contains a menu with this event:
I have a WPF C# application that contains a button. The code of the
I have an application that contains many controls on a panel, each with its
I have an application that contains a VC++ project (along with C# projects). Previously,
We have a windows application that contains an ActiveX WebBrowser control. As part of
I have a console application that contains quite a lot of threads. There are
I have a web application (.war) that contains some static files (e.g. MS word

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.