基本问题:可以在ASP.NET中更改页面URL的更改吗? [英] Basic question: can page URL's change in ASP.NET?

查看:88
本文介绍了基本问题:可以在ASP.NET中更改页面URL的更改吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是非程序员。对不起这个非常基本的询问。当我在ASP.net中设计的网站上访问各种页面时,URL不会更改。具体来说,我搜索已编目的项目,当我从提供的列表中选择时,生成的页面都具有站点URL,后跟/ search。有没有办法让每个页面都有一个唯一的URL,以便用户可以为页面添加书签并回复它们?程序员说,不,这是asp.net的工作方式。如果它们存在,他们显然不熟悉其他选择。关于我应该让程序员调查什么方法的任何建议?非常感谢。



我的尝试:



我是问可能需要指导的程序员。

I am a non-programmer. Sorry for this very basic inquiry. When I go to various pages on a website custom designed in ASP.net, the URL doesn’t change. Specifically, I search for cataloged items and when I choose from the list provided, the resulting pages all have the site URL followed by /search. Is there a way to make each page have a unique URL so users can bookmark pages and get back to them? The programmers say, no, this is the way asp.net works. They apparently are not familiar with other options, if they exist. Any suggestions as to what approach I should ask the programmers to investigate? Much thanks.

What I have tried:

I've asked the programmers who may need guidance.

推荐答案

取决于网站的构建方式。但是,ASP.NET可以使用路由来自定义页面URL。



在搜索方面,典型的搜索只有一个页面,结果将根据查询字符串值而有所不同。例如,如果您导航到 / search 页面并尝试搜索类似目录的内容,那么页面URL将变为类似 / search?catalog = TheValueYouSearch 。但话说回来,这实际上取决于网站的构建方式。
Depends on how the website is built. But yes, ASP.NET can use Routing to customize page URLs.

In terms of search, a typical search will only have one page and results will vary based on the querystring values. For example if you navigate to /search page and try to search for something like catalog then the page URL will turn to something like /search?catalog=TheValueYouSearch. But then again, that really depends on how the site is built.


很难说没有看到代码,但听起来他们正在使用LinkBut​​ton控件导航到搜索结果。这种页面导航方法会将您希望在URL中看到的唯一数据隐藏到请求本身中,以便生成的页面都具有相同的URL。或者他们使用ajax \angular等在不改变页面的情况下在同一页面上显示结果。我的客人是前者。



无论如何,当然你可以让每个网址都是唯一的,如果他们使用LinkBut​​tons进行导航,他们需要将这些更改为普通链接通过超链接控件。如果他们使用某种形式的ajax来填充数据,那么他们需要使用javascript历史API来使网址唯一。
It's hard to say without seeing the code, but it sounds like they're using LinkButton controls to navigate to the search results. That method of page navigation hides the unique data you are looking to see in the url into the request itself so the resulting pages all have the same url. Either that or they are using ajax\angular etc to show the results on the same page without changing the page. My guest is the former though.

Regardless, yes of course you can have each url unique, if they are using LinkButtons to navigate they need to change these to normal links via the Hyperlink control. If they are using some form of ajax to populate the data then they need to use the javascript history API to make the url unique.


这篇关于基本问题:可以在ASP.NET中更改页面URL的更改吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆