Duplicated URLs With And Without Slash
May 2, 2010if I choose without dash, when I try to access [URL] it will return a 301 to the link without dash: [URL] The question is, how can I do that with ASP.NET MVC?
View 3 Repliesif I choose without dash, when I try to access [URL] it will return a 301 to the link without dash: [URL] The question is, how can I do that with ASP.NET MVC?
View 3 Repliesi have a function that pulls URLs from various web resources. needless to say some are full valid URLS and some are relative as per the HTML of the page. below is my asp.net/ c# logic i derived for examining the URL and then generate a full usable URL from whats pulled from the site...
NOTE:
origianlurl is the full url of the first searched page, and relativeUrl is a url found within the searched page (it can be a full www.site.com or a /contactus.html)
private string ResolveRelativePaths(string relativeUrl, string originatingUrl)
{
if (relativeUrl.StartsWith("http") || relativeUrl.StartsWith("www"))
return relativeUrl;
if (relativeUrl.StartsWith("/"))
{
//get main url something.com
[code]...
I've got a folder in my project on a live webserver, called "admin" with a file in it called "default.aspx". Now, I cannot access this folder like this: [URL] however, if I put a slash at the end, it works fine: [URL]
or, this works fine, too: [URL]
I have a date like this:-20091023i have to convert it to a suitable format so that i can insert it into the database.For this firstly i have to convert it to 2009/10/23.How can i do this?
View 2 RepliesHow can we split values from one column? I have a column in table like "work Experience". "02/03" Month and Year. I want to split that values and display in saperate labels. after clicking edit button they are displayed on dropdown list. Similarly i want to do for Annual CTC column.The Split for annual CTC will be Total Sal in Lakhs and In Thousand. Just want to write split function for that.How can i write and display?
View 3 RepliesI often use this code or a form of this code throughout OnClicks and OnLoads:
DataTable dt = new DataTable();
using (SqlConnection con = new SqlConnection(conString))
{
using (SqlCommand cmd = new SqlCommand("administratorGetAll", con))
{
using (SqlDataAdapter da = new SqlDataAdapter(cmd))
[code]...
ASP.NET CustomErrors ignores when a dot before slash is in url
View 1 RepliesHow to rewrite my url from
http://www.mysite.com/8
to
http://www.mysite.com/home.aspx?id=8
I want only one slash after my domain name as
http://www.mysite.com/8
not as
http://www.mysite.com/home/8
I am developing a web application and I am using access as a database. I would like to be displaying duplicated records only from a table. This table has three columns, column1, Column2, and Column3. Column1 and Column 2 have same duplicated values and column3 is unique. The details are as following
column1, Column2, Column3
Red park 4
Blue park 7
Red park 5
Yellow Cann 9
Yellow Cann 12
Now I want when I run the sql I get the following results;
Red park 5
Red park 4
Yellow Cann 9
Yellow Cann 12
i have master page which contains abutton to insert new message this new message should appear in Modal PopUp Extender Control which contains the 2 text Fields (title and subject] and 2 required files validatior controls also there is validation summary control my issue is when open the modal window the symmar validator control save its values and duplicates the error messages
View 1 RepliesThis is a near identical problem I am having to that of this query, albeit mine is a Web Forms scenario (using routing in .NET 4) as opposed to MVC.Add a trailing slash at the end of each url?The solution that someone mentions there is only half provided unfortunately as the link to the complete solution is broken.At the moment, any trailing slash from my page routes is removed when I get the route url.This is especially problematic when I want to use the following type of inline syntax on my web form:
<a runat="server" href='<%$RouteUrl:RouteName=Posts %>'>
Again here the trailing slash is removed, despite it being present in my route table.Can anyone please help provide a clean, efficient solution to this problem? Ideally, like the 'nearly complete' solution provided in the other Stack Overflow thread I've put above?
I am trying to sort out a trailing '/' problem I have. Below is what I have in the web.config. I think I need to add a line in the add input section. If he server receives a direct request for an image say /images/image.jpg then it is rewriten to /images/image.jpg/ - this is a major problem as I have customer 404 error pages to deal with all the page requests. I have had 1000's of exception errors because of this yesterday.
[Code]....
Recently, I am working on the website where I am generating random number and storing it in database as the primary key. So, this key would be foreign key for many table, now how would I generate the random number and check if random number does not have duplication? Is there any function to check if number is not duplicate?
View 1 Repliesi have an table as products colums productid, productname, product value, the values in the colums are .
productid productname productQuantity
1 a1 2
1 a2 2
1 a3 2
1 a4 2
1 a5 2
2 a21 3
2 a22 3
2 a23 3
so when i bind in gridview i need to get the output like this
productid productname productQuantity
1 a1,a2,a3,a4,a5 2
2 a21,a22,a23 3
so how can i get the data in this format when i bind to gridview.
I am New to VB.NET, Iam having a problem such as transaction numberDuplicatiion, Because so many users using a application, Some times transaction trnumber has been duplicatedIn my code i open LOCATION TABLE AND FETCH JOURNAL NUMBERAND INCREASE JOURNAL NUMBER WITH 1 AND THEN UPDATED.SOME TIMES JOURNAL NUMBER HAS BEEN DUPLICATED IN TRANSACTION FILE
View 1 Repliesi have an up & running site based on asp.net 4 routing everything works perfectly except for one page the dynamic route for this page is [URL] i also have a physical folder in the site named admin at first i was getting a iis error when i tired to access this page. then i discovered RouteExistingFiles=true so now the page shows up whats odd though that the sitempappath is empty as well as another sitemap-based treeview on the page so i checked the page's sitemap.currentnode , which is also empty. why? so more research showed that [URL] is always redirected to [URL] (realize the foward slash at end!)
if i search the sitemap like this SiteMap.Provider.FindSiteMapNode("~/Admin") then it returns the node . but like this SiteMap.Provider.FindSiteMapNode("~/Admin/") [-with fwd slash] it return nothing so the question is: why is "~/admin" always redirected to "~/admin/" and how do i either stop it or make the sitemap ignore final fwd slashes?
I have an action for which the output is fairly static, until another action is used to update the datasource for the first action. I use HttpResponse.RemoveOutputCacheItem to remove that action's cached output so that it is refreshed next time the user loads it.Basically I have an action like this:
[OutputCache(Duration=86400, Location=OutputCacheLocation.Server)]
public ActionResult Index()
{
return ...
}
[code]...
I working on a ASP.net project, database is MS SQL
for a reason that cannot find why, when I insert an entry to the data base, the entry is duplicated.
The controll runs this:
Protected Sub grdCustomer_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles grdCustomer.SelectedIndexChanged
Dim Quote As New QuoteBLL
Dim Customer As New BeeSafeShutterSystemTableAdapters.CustomerTableAdapter
[Code]....
I have a webservice (ASP.NET) deployed on a webfarm. A client application consumes it on daily basis. The problem is that some of its calls are duplicated (with difference of milliseconds). For example I have a function Foo(string a,string b). The client app calls this webmethod as Foo('test1','test2') once but my log shows that it is being called twice or sometimes 3 or 4 times randomly. Is this anything wrong with the webfarm or the code? Note that the webmethod has simple straighfarward insert and update statements.
View 1 RepliesI want to rewrite something like this:
www.webaddress.com/article.aspx?date=150211&title=title-of-news-article
to this:
www.webaddress.com/150211/title-of-news-article
Even to achieve the first link above, I need to replace capital letters and non-standard characters like é with e, and replace spaces with hyphens. Is all of this possible using URL Rewrite Module 2.0 or might I be better off coding some ASP? I'm new to .net and may have to do something in classic if I struggle. And I only just get by in ASP...
I've tried some of the tutorials on the official IIS website and have got through a simple rewrite wizard, but replacing characters seems more complicated, and I'm sure some of the tutorials have errors in them...
I need to Encrypt the URLs in my ASP.NET MVC application.
Do I need to write the code in Global page in Route Collection to Encrypt all the URLs?
I have a application which uses intelligencia urlrewriter to rewrite urls into seo friendly urls. Blog engine is integrated in this application under subfolder but shares webconfig with my application. Application runs perfectly on development server, but when i publish it to 2008/IIS7 server urls links don't work. Links similar to following work
<rewrite url="^/Abc" to="~/abc.aspx" processing="stop"/>
<rewrite url="^/Abc_123" to="~/abc-123.aspx" processing="stop"/>
But links like following fail to redirect and i get 404 errors
<rewrite url="^/Abc/(.*/)" to="~/abc.aspx?id=$1" processing="stop"/>
<rewrite url="^/XYZ" to="~/xyz.aspx?cat=school" processing="stop"/>
Anything which has query parameters in aspx url fails. I'm not sure what is causing this error on 2008/IIS 7 server and not on my VS 2008 development server.
I am using asp.net and when I type a bad url manually(in the browser) it gives me: The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. I want a bad url that doesn't exist to be re-directed to the home page. How do I do this?
View 4 RepliesI am using the NerdDinner project to experiment with MVC. http://nerddinnerbook.s3.amazonaws.com/Intro.htmI have put an image map on the front page and cannot work out how to generate the urls for it.
[Code]...
I know the default routes in MVC include an id param which often maps to the identity of an entity as it's stored in the database. Now, often this is OK, but what about when you don't want someone to be able to manipulate it? Quite frankly, on many business apps this is very common. For example, you don't want someone to change the account number (not the best example, but you get the idea) in the URL for obvious reasons. So, you would need to validate the account number against the logged in user on every request. Obviously, that is not a realistic solution, and in webforms many people would store something like that in session. I am trying to rely on session very little in MVC, but aside from that would I just go old school and use hidden fields
View 2 Replies