C# - Definitive Removing Urls In A Textbox?
Feb 13, 2010I have a comment box and do not want people to post urls.
the site is written in c# asp.net
I have a comment box and do not want people to post urls.
the site is written in c# asp.net
i 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 have a text box, on text_changed event i get one data table which i bind with the grid view, but every time i have to move the cursor out then only it feteches the datatable, while i want to make this search like if i as i change the character in the text box it keep working for all without removing the cursor from the text box, how can i achieve this. Should i use any java script or what.
View 2 RepliesMy datasource returns up to 3 different values for each item: a contact name, a company name, and an email address
The problem is, this ends up returning the same company names multiple times in the returned list of suggestions
Is there a way to weed these duplicate items out using JQuery or is there another method I should use?
Here is my implementation
[Code]....
I have a multiline textbox that by default, is set to ReadOnly. I would like a button on the page to change the control to allow it to be edited. I would like this code to run on the client side because the page renders slowly and I'd like to avoid the post back.
The problem I'm having is the javascript code that I wrote to remove the readonly attribute appears to have no effect. I posted a stripped down example that illustrates the problem for your review.
[code]....
Long ago, I created an ASPNET user for development use.However, every time I boot up my dev system, I'm presented with a user login for ASPNET, among others.I don't want to remove ASPNET; I need it for dev work.But how do I keep it from appearing among the list of User Logins available at boot-up?
View 4 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]...
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 RepliesI 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 RepliesWhat is the best way to implement friendly urls in asp.net 2.0 for example I have http://www.predatorsfc.org/BrowseThreads.aspx?ForumID=23 and would to like add the forum title to the url to make the url more user friendly ?
View 6 Repliesi want to convert my dynamic urls to static urls.
I dont have apache installed on my server so it cant be through .htaccess re-write.
Here is the example what i want :
[URL]
I want to change all odds.asp pages to static URLs.My previous posts and new posts too.
Here is my odds.asp file
[URL]
My site was working fine before I starting working on incorporating URL redirection/rewriting. I have tried to preface all the URLs for graphic images and navigate URLs with a tilde and a slash ("~/"). However, now that I'm using rewriting on many of my pages, if the number of folders in the URL is 2 or less (such as MyDomain.com/Title/Author), it finds the graphics files without any problems, like before. When I view page source, I see that the HTML is calling for relative URLs that start with "../../", which is why it works for 2 or less folders in the URL. When there are 3 or more folders (such as MyDomain.com/Title/Author/Category), then it doesn't display the graphics files.
why I'm getting these relative URLs and so the files are not displaying correctly at times?
I have a program that parser html and collecting urls. The problem is when checking for duplicates before I add them to an arraylist is that I cannot distinguish between types of the following format:
http://forums.asp.net/AddPost.aspx?ForumID=15
http://forums.asp.net/AddPost.aspx?ForumID=15/helloworld.asp
http://forums.asp.net/AddPost.aspx?ForumID=15/helloworld.asp/byeworld.html
Now if I captured the first url, how can I avoid collecting the next few since they are not technically duplicates.
I want a regex expression which only match extensionless url. In otherwords if an extension is present in url then completely ignore it.
/(.+)/(.+) this will match an URL both with and without extension.
www.site.com/sports/cricket should match
www.site.com/sports/cricket.aspx shouldn't match
I am working on a website in which many users can create their account and have a personalized page. I wish to provide them a twitter like url to access their pages, for example www.mysite.com/smith or www.mysite.com/john . I am using asp.net mvc 1.0. I have an understand that i can add routes to the global.asax file, but i am not able to figure out how to add a route that will work for such urls.
View 2 RepliesI've been using the LongURL.org API for expanding short URLs. The great thing about this service is that it returns a long URL, the title of the actual page and meta-info.The real problem I have is that it seems to take an inordinate amount of time to fetch the data. I'm considering shifting the request to JavaScript so that the URL is fetched via an AJAX update panel, in order that the page loads quickly, and the URL data is updated while the user looks at the content (some search results).Does anyone know how else I could gather the info described above, n a better time-frame? I'm using C# ASP.NET but would consider solutions in other languages.
View 2 RepliesI am interested in the architecture of a CMS where i can pass a full URL instead of a query string. I would like to make a site that could handle a request to any page... Say'http://www.my-domain.com/directory/page.aspx'and have the resulting response deliver a generic page/file.I would like the request to be passed through an XML document where i could store page names and the corresponding file to render content...
View 1 RepliesHow would you accomplish these in ASP.NET Webforms 4.0 Routing;.aspx pages should not be accesible directly, pages should be accesible only with routes,
Start page should be "/" or "/home" or something else, but not "Default.aspx".
URLs are stored in a database, example:
home/page1
gallery/image1
info/IT/contact
home/page2
home/page3
gallery/image2
info/IT/map
and so on.
I would like to arrange the above urls into a tree fashion as shown below (each item will be a url link). The final output would be a simple HTML List (plus any sub list(s))
thus:
home gallery info
page1 image1 IT
page2 image2 contact
page3 map
Programming Language is C# , platform is asp.net
EDIT 1:
In the above example, we end up with Three Lists because in our example there is three main 'groups' eg: home, gallery, info.
I have recently updated a website. All of the urls have changed. Now I get traffic to old urls that doesn't exist anymore. However, most of these url's have corresponding pages on the new site. I believe most of the traffic to the old urls are spiders. What would be the correct way to handle this?
Preferably I'd like a solution that gives a nice experience for the real users if they type in an old url (or use an old bookmark they've made) but that also notifies the spiders of the change of url, so that they can update their registers. However, if the two are hard to combine, the last one is prioritized (since most of the traffic is spiders). I'm using ASP.NET
[ActionName("about-us")]
public ActionResult EditDetails(int id)
{
// your code
}
The above works for actions but I would like to be able to do the same (or similar) for controllers, ie have a hyphen in the URL name too. Is there any easy way to achieve this (I tried the ActionName attribute but no luck)