locked
Create new URL for API results URL RRS feed

  • Question

  • User1122679459 posted

    I'm not sure how to explain what I'm trying to do but here it goes...

    I want to hide URLs and create a sort of reference URL in my app from the URLs that are being returned in the results of an API. So whey my URL is clicked, the original URL I received from the API will load in the browser.

    The API returns URLs as:

    http://www.domain.com/view?k=066f952bb6793d2b&qd=VurSLpjL_C5x-OsC8F-9NGcYiUmqnprrq2MtIyXogmRpzcw_E7jGkHBk-CGbv6Dm_Xi5BXyNYBQGtr4UYaav2xGUWcVBinyLZAVK0SVVur0&indpubnum=1757981803167718&atk=1806r4s2v0mph2o9


    I'd like to create my own, maybe something like:

    http://www.mydomain.com?trackurl=53203711132E9285ADD736D7744B9357C02BF750



    Tuesday, July 29, 2014 9:37 AM

Answers

All replies

  • User895691971 posted

    I was working with this functionality for really a very long time and I never understood how to handle the Query Strings on the very first page (Index.cshtml or Default.cshtml). However this very functionality always worked for me when I do it on some sub page, but not on the main page. 

    What I always got the answer from this forum was to use ASP.NET Url Routing. 

    http://msdn.microsoft.com/en-us/library/vstudio/cc668201(v=vs.100).aspx

    This is a post, which might be helpfull for you to understand this function.

    Tuesday, July 29, 2014 11:57 AM
  • User1122679459 posted

    Thanks Afzaal, I read through it but really looking for other alternatives.

    Also want to mention that I'm not using web forms or MVC...if that matters.

    Anyone else have an idea?

    Tuesday, July 29, 2014 2:06 PM
  • User895691971 posted

    Web Forms and MVC just have the implementation differences, the code that can be used is same. So any idea that is working in MVC, you can use it in Web Pages just by changing it a little bit. 

    I used the very same thing in Web Pages, but as I mentioned, this feature doesn't work in the Default.cshtml page (atleast in my case). So you can't have that to work, untill you use Url Routing service in web.config or some other task like that. Web Pages, as far as I know, doesn't allow this feature in Default.cshtml.

    Tuesday, July 29, 2014 3:37 PM
  • User-1454326058 posted

    Hi olavarrieta,

    To hidden the original URL, we could use IIS Rewrite.

    More information, please refer to:

    # Creating Rewrite Rules for the URL Rewrite Module

    http://www.iis.net/learn/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module

    For the ASP.NET application, you may use ASP.NET Routing.

    More information, please refer to:

    # ASP.NET Routing

    http://msdn.microsoft.com/en-us/library/vstudio/cc668201(v=vs.100).aspx

    Thanks

    Best Regards

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 30, 2014 2:32 AM