Url Mapping with asp.net [closed] - c#

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I'm creating a site, and i need to have my urls mapped . I want to avoid losing css during mapping. I want something like this..
http://www.vitagamer.net/Game.aspx?id=12
to
http://www.vitagamer.net/games/this-is-a-game-name/
now I've been thinking about the following algorithm..
receive the requested url..
break into parts, and search database for id associated with "this-is-a-game-name".
serve the http://www.vitagamer.net/game.aspx?id=12 page
I've been looking on the web but i'm confused. How do I do the mapping?
how many ways are there?
is there a difference between rewriting and mapping?
Update
I also need to add hyperlinks to my pages that are shown like
http://www.vitagamer.net/games/gamename/
should I just do things with strings? or there's a more efficient way.

As you seem to be on Asp.Net WebForms, I would suggest writing a HttpModule to catch the incoming requests and rewrite the URLs.
This is a duplicate question and I've found my suggested answer as the second one here: ASP.NET URL Rewriting

You should look into Microsoft.AspNet.FriendlyUrls to easily use routing and get "friendly urls" or "extensionless urls" for ASP.Net Web Forms.
Here's a primer from Scott Hanselman

IIS 7 has support for URL Rewrite, you can use IIS interface to manage URL(s):
http://www.iis.net/downloads/microsoft/url-rewrite

Related

Make my Asp.Net application support all browser [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have an asp.net application which was initially designed for support only in IE(Internet Explorer). Now i want to convert that application which will support all the latest browser,
Basically it was developed Asp.net, CSS and Javascript(Specific for IE).Is there any easy way to convert because I have only 1 week time to Submit if i failed then i need to report whether it is possible or not?
Here's the quick answer - it will probably take you longer than a week :)
The best thing to do is view your website in different browsers and see what the problems are. You have been a bit vague in your question, but you could be looking at having to fix UI issues and possbily JavaScript problems.
Which version of IE are you supporting? You need to take this into account since developing for cross browser support means not only fixing problems for modern browsers, but making sure that older browsers are not broken.
This is a very open-ended question, and the best suggestion I have is the above. There is no way to convert an application to magically be cross-browser compatible. It's going to be a manual job unfortunately.
Most importantly, you need to to measure how bad things are in other browsers before you can get a plan together of what it will take to fix.

How to route requests to a method in a class in WebForms? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
In MVC one can write a custom route that points to a method on a controller, i would like to achieve the same functionality with WebForms.
If i have a route like;
Admin/{Controller}/{Action}
I would like to user a Url like the one below to invoke the Register method on a User class/controller.
http://[domain]/Admin/User/Register
How do i go about doing something like this.
NOTE
I've found an answer to my question elsewhere;
http://www.west-wind.com/weblog/posts/2011/Mar/28/Custom-ASPNET-Routing-to-an-HttpHandler
Basically, i am using WebForms to develop an app, however wanted the controller concept of the MVC - the ability to execute methods that exist on a controller. I've been able to achieve my goal, thanks to that article.
All WebMethod's on a page must be declared as static, and a User.aspx has a class in your application, so anywhere in your code you can call User.Hello()
What you want to do is better served with a WebService, however I don't see anything technically limiting you from doing it this way.

How to use URL rewriting in ASP.NET 4.0? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I want to use in-build URL rewriting provided by ASP.NET 4.0. I have tried the following code but i dont know why this is not working as i am totally new to this topic.
I have tried the code from the following link:
http://code.msdn.microsoft.com/Easy-Steps-to-URL-2f792901/view/Discussions#content
But this code is working.
Please help me and it would be much better if any one can provide me code that is working..
What i want to is:
I am working on Some Social networking Site, client want when user tries to watch any other's profile then he will be visible the url like :www.test.com/profile/UserName This is my main goal. i didnt do URL rewriting so i have started from the beginning. But still i am not getting such type of example that meet my goal.Please if any one can, help me...
It is not necessary to write code to perform url rewrite. You may want to use IIS rewrite module extension, you can download it here http://www.iis.net/downloads/microsoft/url-rewrite
It is a Rules-based URL rewriting engine
for example you can rewrite testpage.aspx?name=testcase to /testpage/testcase via regular expressions

Implementing code first model in mvc 3 [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I'm trying to use code first model for my simple blog site, I'm used to with database first, but an experienced guy told me to use code first, but I'm having lots of trouble to implement this, even the simplest thing like setting identity to the key value, defining relation between two entity, handling image type data. I do want to understand the inside out of this approach, I tried to search quite a lot, but didn't get the desired information. Can someone please help me with the information like where to start, how to proceed & get expertize on the code first model?
Thanks in advance.
Check out this: Entity Framework Code First to Database on MSDN.
Even better, the tutorial uses a Blog as the example application.
There are tons of tutorial out there on code-first approach.
you can start with asp.net mvc official site: http://www.asp.net/mvc
here is another tutorial: http://www.asp.net/mvc/tutorials/mvc-music-store/mvc-music-store-part-1 (Code First Approach)
and you can find a lot projects here: http://www.codeplex.com/ you just need to search

ASP.NET MVC Template built in with Visual Studio [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
does anyone know awesome templates for Visual Studio integration. I have found some here http://mvccontribgallery.codeplex.com/, but they are dead. I would like get the same for free or for money.
Thank you.
Here http://pixelsinspired.com/ is only one application template, but it looks that the rest is coming soon. Ready to go designer templates with CSS/HTML and basic application utils like logging and etc.
Depending what you're building with ASP.NET, you could always use a basic HTML theme, and cut out the middle part, make a master page and views. If there's re-usable elements, break them down into partials.
Assuming you're not using some CMS software, you'll probably be needing to customize the views to match data coming from your controllers.
One of the advantages of ASP.NET MVC vs WebForms is that's much closer to other templating languages. It wouldn't be that bad to convert an erb,twig or smarty template to ASP.NET. I'm guessing that most of what you're really looking for is the markup and CSS.

Categories