3
Contributors
19
Replies
54
Views
4 Years
Discussion Span
Last Post by ss125
0

@Ketsuekiame,
I dont want to make the user to view the file name... All they can see from the path must be only the domain name.

0

But, if you encode the website uri, then the page name effectively becomes the encoded value. You don't actually gain anything other than obfuscating the original filename...

You could do it using symmetric encryption and a datetime stamp salt to vary the generated content, decrypt that and load your page. But considering that this is so much work for what I'd consider to be no gain, please consider the actual requirement as to why you need to obfuscate the file name.

Edited by Ketsuekiame

0

I was just thinking of encrypting a part of the url and posting it in the URL region of the browser. so that it will be directed to a common page from where the encoded page name will be got and decoded and redirected to that page.

Just as the same as a middle-man service to encryption and decryption purpose of the data. I was just thinking about the possibility of doing that. If possible I am going to give it a try.

I know that there is no gain in it, but I need to try that logic to gain knowledge...

0

Well it's certainly possible, but you will need to adjust your routing so that you only ever have the root controller. When you retrieve the encoded section, you will need to decode it and load the appropriate view.

This can all be done in MVC 4

0

@Ketsuekiame:

Fine then.

I have a scenario.. Can you please tell me whether It can be done in the following scenario.

My applicaion consists of an login form,welcome form and a mid.cs file. The mid.cs file contains the encode and decode functions. I got the steps until the url is encoded. Now the doubt is about is it possible to change the URL of the page to the encoded URL?

0

Hmm, if you're not using MVC then I honestly don't know. I can't imagine why not. If you have a general landing page, your links out of the page need to be your encoded values.
When you post to the page, you send your encoded values and then decode them with your mid.cs file. Once decoded you should be able to select the appropriate file for rendering.
As you will need to redirect your output, I don't know how this will be handled in normal ASP.NET (WebForms). In MVC, you can set the View explicitly so that the target filename will never be displayed.

I will ask a mod if your question can be moved to the ASP.NET forum, they might be able to give you a better answer than I can.

0

@Ketsuekiame:
Are you referring to the ASP.Net forum in Daniweb?

0

I don't know how this will be handled in normal ASP.NET (WebForms).

If you are using ASP.NET web forms, you can use the URL Rewrite module to help you with this.

What i would invision is that you need to direct all of you traffic to one page, then use some code in the Page_Load subroutine access the querystring (from the rewrite see below), then use the query string and decode the value, then based on the results, use server.transfer("newpage.aspx").

ASP.NET will show the user the contents of newpage.aspx, but will not change the URL in the address bar. If you perform a response.redirect, it would.

The URL rewrite code in your web.config may look something like this...

<rewrite>
      <rules>
        <rule name="Decode" stopProcessing="true">
            <match url="^([_0-9a-z-]+)" ignoreCase="true" />
            <action type="Rewrite" url="landing.aspx?q={R:1}" />
        </rule>          
      </rules>
</rewrite>

please note that i wrote this from memory...i've never attempted to build a process that you have desribed, but I dont see why it wouldnt work.

Again, to get this to work, you need to have the URL Rewrite module installed on IIS.

You probably need to tweak the URL rewrite code above because not every URL will be incoded correct? How will the user access basic pages like home, about, etc..?

0

@JorgeM,

you need to have the URL Rewrite module installed on IIS.

I am using Visual studio 2010 to develop thi application. So I think there is no necessary of IIS installation. And also I am working in a office system, which does not allow an employee to easily install products.

You probably need to tweak the URL rewrite code above because not every URL will be incoded correct? How will the user access basic pages like home, about, etc..?

I am creating an web application in which there will be flow in the application such that after this page the user will be automatically redirected to the next page as programmed. So there is no need to worry about basic access page as you said.

0

If you are using Visual Studio, it has a local instance of a basic version of IIS. There's no support for the URL Rewrite module, as far as I know. However, you can also use ASP.NET Routing and add routes to a web form application in the global.asax. I have more experience with the URL Rewrite module. I really have not used the global.asax option, but take a look as this may be helpful for you.

http://msdn.microsoft.com/en-us/library/cc668201.ASPX#adding_routes_to_a_web_forms_application

0

@JorgeM:
Well Its a good link. But that is totally different from what i need. But anyway thankyou, As per Ketsuekiame answer, I can able to do that in a MVC architecture(Correct me if i am wrong). What are you thinking about that?

0

Unfortunately I am familiar with web forms, not MVC. I would address this design using the URL Rewrite module with a similar example I posted above. I am not sure what else I can add to give you more guidance on how to resolve this.

The key here is that when a user accesses a URL, the web server needs to know what to do with the request. You have to intercept it somehow and perform some action. URL rewriting handles this very well.

So lets go back to your original post. I assume that what you want is when someone accesses the following URL -->

http://www.mangabooks.com/sdDFREdsfefrvgrwghWr34r

The user is taken to -->

http://www.mangabooks.com/welcome.aspx (but the original URL is displayed in the browser bar)

Then, you want to take the string "sdDFREdsfefrvgrwghWr34r", decode it and then present the user the appropriate view, or send the user to another page. If that is correct, again, the only method I've used is URL Rewriting (in web forms).

Edited by JorgeM

0

@JorgeM,

As per your suggestion I am having a doubt. Consider the following code.

  <rewriter>
    <rewrite url="~/products/books.aspx" to="~/products.aspx?category=books" />
    <rewrite url="~/products/CDs.aspx" to="~/products.aspx?category=CDs" />
    <rewrite url="~/products/DVDs.aspx" to="~/products.aspx?category=DVDs" />
  </rewriter> 

does the user gets the page "~/products/books.aspx" when the following url is typed?

~/products.aspx?category=books"

I Mean,when I type the URL in the address bar like below

www.mangabooks.com/products.aspx?category=books

Does the page

www.mangabooks.com/products/books.aspx

will be accesible?

0

I see where you have your doubt. Actually, it looks like your thinking is in reverse with regard to URL rewriting.

One of the purposes of URL Rewriting is to provide your users with easy to remember URLs as well as improving SEO (search engine optimization) for your site.

So for example, you would give your users and/or create links on your site such as:

http://www.yourDomain.com/products/books/

If you notice, its a very easy to read URL. No need for file extensions. Anyone seeing this URL knows that the page is related to book products.

With URL rewriting, we can accept this URL from a user and show the content from the page:

http://www.yourDomain.com/products.aspx?category=books

To learn about URL rewriting for ASP.NET web forms, I would start here:
http://www.iis.net/downloads/microsoft/url-rewrite

This is a great web page that I have bookmarked that has common tips and tricks: http://ruslany.net/2009/04/10-url-rewriting-tips-and-tricks/ (i have even reached out to this author on iis.net for help. he's awesome when it comes to the url rewrite module).

0

@JorgeM,
Thank you. The links are helpful. I am working on it.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.