.net - How To Get A Trailing Slash Appended To Page Routes
Nov 11, 2010
This 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?
View 1 Replies
Similar Messages:
Dec 9, 2010
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]....
View 1 Replies
Feb 19, 2011
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]...
View 3 Replies
May 25, 2010
I'm trying to prevent direct file requests from being accepted, and have tried this:
[Code]....
None of these worked. I want the rule to exclude any file of any filename in any directory with a matching extension. How can this be done?
View 11 Replies
Jan 28, 2011
I am using .NET Page Routing (not MVC) to get pretty URLs (or at least removing the file extensions) on my site.On my search page, when a user searches for "stuff" it redirects then to /search/stuff for the results. However when I put in something like "stuff yes:" it gives me a HTTP 400 Bad Request Error.
I tried using javascript to encode the search value before being submitted, and confirmed that "stuff yes:" was converted to "staff%20yes%3A", yet when it performs the routing redirect, in the URL it shows "staff%20yes:" and causes the bad request. Why is it not saving the encoding for the typically illegal characters and how can I make it so?
View 1 Replies
Jan 28, 2010
I am using webformrouting in my asp.net c# application.
In my global.asax file i define a couple of routes.
My question is, how can i get a list of all routes defined from code behind (on a page)?
View 1 Replies
Feb 11, 2012
Im looking on some routes.MapPageRoutes but i cant get it to work.
I have these link
ROOT
default..aspx
brands.aspx
service.aspx
contact.aspx
aboutus.aspx
shopping.aspx
ALL these pages is running with a masterpage
eb.master (also in the root)
And then i have the global file that have the namespace in the global file also.when im running the pages/website and i have the default.aspx page activ, it show
www.mydomain.dk/default.aspx
when i wanted it to be
www.mydomain.dk/Butikken
Its the same problem with the others routes....
Code:
<%@ Application Language="VB" %>
<%@ Import Namespace="System.Web.Routing" %>
<script runat="server">
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
[Code].....
View 2 Replies
Jan 9, 2011
I am trying to create an Area for running DynamicData with scaffolding as an administration part. It's probably working as it should but I can't get the routing to work.
In my global.asax I have the following function to register the routes:
[Code]....
Unfortunately the "best" thing that happened to me so far was that when I check the default tables I get a message about (MetaModel.VisibleTables)
[Code]....
The problem is that I don't know why this is. Is it the routing or something else? Is it perhaps some security thing or can I not put dynamic data inside an area?
The DynamicData folder itself is located in the root of the application since that is the convention it uses and I have no intention to override that.
View 1 Replies
Feb 24, 2011
I am using a master page and I need to change how the <title> element is rendered. The <title> content renders as expected. The problem is the whitespace that bounds my <title> element. I want to get rid of it.How do I remove the leading and trailing characters
View 4 Replies
Feb 11, 2010
[Code]....
I'm attempting to import, using VB.Net, a spreadsheet from some other users than myself. In the spreadsheet with headers, the numbers I'm importing are in the first column of the spreadsheet (Excel 2003 to 2007). I've defined my datacolumn for the column with the numbers as a "string". What's happening is the trailing zero is dropped; so 1.1 and 1.10 both appear as => 1.1.My code is attatched below.I know I'm missing something, I just don't see it!I've tried both; MicroSoft.JET.OleDb.4.0 and MicroSoft.ACE.OLEDB.12.0 but neither seems to make a difference.
View 1 Replies
Apr 27, 2010
I want to get the valid emailID from the list.If I use the emailaddress from the address book of any mail account then the name of the user get appended with the emailID .eg:"Ayushi Soni" <asoni@[URL]>,.. and then copy these address to a textbox in an asp.net application.
Now I want to retrieve the actual EmailID from the list ignoring the name that is appended.Is there any utitliy that we can use to filter this out and validate the filtered email. I donot want to use regex for this.
View 10 Replies
Mar 21, 2010
I'm new to jQuery so this may be a real simple answer. I have a ASP.NET project that I'm trying to dynamically add content to an ASP Label element by typing into a text box and clicking a button. Sounds simple right? Well, I can get the content to added, but when the form is submitted the Label element is still empty? Why is the new data not submitted? Here's some sample code:
<asp:Label ID="lblContainer" Text="" runat="server" />
<input type="text" name="tag" id="tag" />
<input type="button" name="AddTag" value="Add" class="button" onclick="addTag();" />
function addTag() {
if ($("#tag").val() != "") {
$("#lblContainer").append('$("#tag").val()' + '<br />');
$("#tag").val("");
}
}
View 1 Replies
Jun 5, 2010
I have a client side code that creates an AJAX request to the server (using jquery). My problem is that one of the json results called 'name' gets spaces appended to the value.
For example: In the DB the value is "Hello" but when i get the request back using ajax it comes out as "Hello "
It is ALWAYS the one value that gets spaces appended, even on calls to different functions in the web service. Ive tried changing its name on the AJAX response, but the same thing happened.
Ive gone and ran queries directly against the web service by navigating to its address using my browser, and executed the query manually, and it comes back properly ("Hello").
Ive also tested this in IE, FF, Opera, Chrome and using different computers with the same results.
View 4 Replies
Apr 15, 2010
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]
View 2 Replies
May 2, 2010
if 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 Replies
Feb 26, 2010
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 Replies
Mar 4, 2010
What has gone wrong. NOTE in both cases I got the blue wavy line under txFindCandidate but when free within a ContentPlaceHolder the code works.... when nested within LogInView LoggedInTemplate it fails.
View 2 Replies
Aug 11, 2010
in my mvc2 application i have an action link like
[Code]....
docid is set to empty string because i want to clear ambient value of docid that is present in request context. i have gone through a lot of material on internet and even tried docid=String.Empty but it does not solve the problem and gives me url like /controller/action/id?docid=x. i also write a routeconstraint as suggested but it did not solve the problem either.clear those route values comming from request context with html.actionLink. i don't want to use html.routeLink
View 5 Replies
Sep 23, 2010
How 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 Replies
Sep 22, 2010
ASP.NET CustomErrors ignores when a dot before slash is in url
View 1 Replies
Sep 24, 2012
How 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
View 1 Replies
Oct 13, 2010
i 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?
View 2 Replies
Feb 18, 2010
So, in my example below, "InputDate'" is an input type=text, "DateColumn" is a TD within a table with a class of "DateColumn".
Read the value of a discreet texbox:
var inputVal = $('#InputDate').val();
Read the value of a div within a table....
This works:
$('#theTable .DateColumn').each(function() {
var rowDate = Date.parse($(this)[0].innerHTML);
});
This doesn't:
$('#theTable .DateColumn').each(function() {
var rowDate = Date.parse($(this)[0].innerHTML());
});
The difference is the "()" after innerHTML. This behavior seems syntactically inconsistent between how you read a value from a textbox and how you read it from a div. I'm ok with sometimes, depending on the type of control, having to read .val vs .innerHTML vs.whateverElseDependingOnTheTypeOfControl...but this example leads me to believe I now must also memorize whether I need trailing brackets or not on each property/method.
So for a person like me who is relatively new to jQuery/Javascript....I seem to have figured out this particular anomaly, in this instance, but is there a convention I am missing out on, or does a person have to literally have to memorize whether each method does or does not need brackets?
View 2 Replies
Oct 27, 2010
OK, I'm sorry if the tile of the question was unclear, and if you understand what I mean, please don't hesitate to help me think of a better one.
Anyway, I have a <input type="submit"> element for my form, and I want it to return the same URL as the URL of the page the element is on.
Currently, if I click the button, it takes me from /Calculate/Quadratic to /Calculate/QuadraticForm
In my controller for this view, I have the following code:
[AcceptVerbs(HttpVerbs.Get)]
public ViewResult Quadratic()
{
ViewData["Root1"] = "";
ViewData["Root2"] = "";
return View();
}
[AcceptVerbs(HttpVerbs.Post)]
public ViewResult Quadratic(QuadCalc boss)
{
ViewData["Root1"] = x1;
ViewData["Root2"] = x2;
return View();
}
And here is the markup and code for my Quadratic view page, which includes the form which includes the submit button I've been referring to:
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>Quadratic</h2>
<% using(Html.BeginForm("QuadraticForm", "Calculate")) %>
<% { %>
<div>
a: <%= Html.TextBox("quadraticAValue") %>
<br />
b: <%= Html.TextBox("quadraticBValue") %>
<br />
c: <%= Html.TextBox("quadraticCValue") %>
<br />
<input type="submit" id="quadraticSubmitButton" value="Calculate!" />
<br />
<p><%= ViewData["Root1"] %></p>
<p><%= ViewData["Root2"] %></p>
</div>
<% } %>
</asp:Content>
Therefore, all I really want is to have the submit button return the same page, but the HTTP post will aid the application in passing new ViewData. Unless I'm interpreting this all wrong.
View 1 Replies
Dec 28, 2010
I have a server that has been using ARR 2.0 on IIS 7. I recently added MVC 2.0 to my ASP.NET site. After adding it the ARR routes return the following error: The virtual path 'null' maps to another application, which is not allowed. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ArgumentException: The virtual path 'null' maps to another application, which is not allowed. Source Error:
[Code]....
Stack Trace:
[Code]....
In my web.config I can remove the modules attribute runAllManagedModulesForAllRequests and the ARR works, but it makes the MVC routes stop working.
View 2 Replies