none
global configuration to hide or encrypt query string/parameter on get request RRS feed

  • Question

  • i am building a mvc 5 application. 
    i need a global configuration to hide or encrypt query string/parameter on every get request.
     
     
    is it possible?? 

    • Edited by Johnykbd Sunday, May 7, 2017 9:05 AM
    • Moved by Sabah ShariqMVP Friday, May 12, 2017 1:33 PM Moved From Visual C#
    Sunday, May 7, 2017 9:03 AM

All replies

  • Hello Johnykbd,

    There are several ways to do this.  The easiest way to hide the details of a request between machines is to make the request secure (re: https).  MSDN has good documentation on how to do this here.  This might also be helpful.

    To enforce https on a specific controller or action then you can add RequireHttpsAttribute.



    Cheers, Jeff

    • Marked as answer by Johnykbd Monday, May 8, 2017 4:52 AM
    • Unmarked as answer by Johnykbd Thursday, May 11, 2017 9:28 AM
    Sunday, May 7, 2017 8:32 PM
  • If you mean to hide the parameter from browser's address bar, try open a popup window with address bar hidden (may not work for some browser), or open your page in an iframe of a main page.

    If you're willing to do more work, you can implement your base controller (if every controller in your site have the same base controller to inherit from) to push the model to session then return javascript "history.pushState(url);" with script tag as page content to reload the page without parameters, then reload the model from session if found. (I'll leave how to "determine whether it's the first visit or have visited before but redirect to here again from other pages" to you to decide. Note that this is really depending on how you implement your pages, and not considering all aspect of usage included requests made by your components will give you subtle bugs difficult to diagnose)

    Monday, May 8, 2017 2:05 AM
  • Hi Johnykbd,

    Thank you for posting here.

    According to your question is more related to MVC, you could post a new thread in MVC forum for suitable support.

    The Visual C# discuss and ask the C# programming language, IDE, libraries, samples and tools.

    If you have some grammar or code errors, please feel free to contact us. We will try our best to give you a solution.

    Thanks for your understanding and cooperation.

    Best Regards,

    Wendy.


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, May 8, 2017 2:31 AM
  • I tryed to implement SSL but its not working.would you like to suggest me another way please.
    Thursday, May 11, 2017 3:57 AM
  • Hi Johnykbd,

    This is Visual C# forum. As your issue is related to Web, please ask your question into ASP.Net forum for getting quick response. I am moving your thread to off-topic.

    https://forums.asp.net/

    Your understanding and cooperation will be grateful.

    Thanks,
    Sabah Shariq

    [If a post helps to resolve your issue, please click the "Mark as Answer" of that post or click Answered "Vote as helpful" button of that post. By marking a post as Answered or Helpful, you help others find the answer faster. ]

    Friday, May 12, 2017 1:33 PM