-1

I'm making a small Forum where user can start topics and reply, it's just like bulletin board, I'm doing this asp.net project for learning purpose, as I noticed in many forums or bulletin board they use separate pages, (actually I don't know how they achieve) to display result

for eg: How to read an external html page using jquery?

in that for every query " questions/6327018/how-to-read-an-external-html-page-using-jquery" this will be changed automatically based on the query, I don't know how to achieve this in asp.net.

if user select his topic, based on topic it has to show in separate page like above the stackoverflow eg ..

2 Answers 2

1

Stack overflow is written using MVC. Hence in the case of this posting you have a controller named "Questions" (the class is really named QuestionsController) that takes a parameter of "6333181" as an integer. Your route points to some method - generally named "Index". So in QuestionsController.cs you would have a method like:

public ActionResult Index(int postingId)

Note - the URL for this posting can be How to display query results in seperate page like Stack Overflow in asp.net without anything else.

In MVC this is quite simple and is designed this way out of the box. No url rewriting required, this is how you setup your routes in the global.asax.cs in an ASP.Net MVC application.

For stack overflow this can be confirmed here:

https://blog.stackoverflow.com/2008/09/what-was-stack-overflow-built-with/

Sign up to request clarification or add additional context in comments.

Comments

0

The way that is achieved is using URL rewriting. Behind the scenes that url "questions/6327018/how-to-read-an-external-html-page-using-jquery" is redirected to something presumably like "questions.aspx?id=6327018".

That's the first step, you need to get your application to handle URL rewriting. It's pretty easy these days in IIS/ASP.NET, there's a built in extension so you can just set that up in your web.config.

The second step is using that id=[number] and querying the database for the data associated with the question with that id and displaying it on page.

5 Comments

Can u give me some tutorial to above problem, it will really helpful to me. or the way to use in asp.net,
Here is a page describing how to do url rewriting.
I actually prefer the official IIS module I was referring to: learn.iis.net/page.aspx/460/using-the-url-rewrite-module
Also, here's some general information on connecting to a DB: msdn.microsoft.com/en-us/library/ms178371.aspx There are also plenty of other tutorials to help with that too. If you come across specific issues while working through those, ask new questions here on SO and we'll be glad to answer :)
no url rewriting required - stack overflow is an MVC application. see my post

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.