.NET MVC Using IDs In URLs Default Routers?

Sep 2, 2010

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


Similar Messages:

Security :: Redirect Javascript And CSS URLs To Homepage(Default.aspx) By Web.config?

May 28, 2010

I want to redirect my Javascript and CSS URLs to Homepage(Default.aspx) by web.config or via anyother way in ASP.Net. I tried to try it but I can't able to do this thing. I have already checkout ASP.Net professional book but I can't get any reference for it anywhere.

View 2 Replies

Logic For Fixing Relative Urls To Full Urls

Nov 16, 2010

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]...

View 1 Replies

Security :: Allowing Access To Default.aspx With Default Document Enabled?

Jan 19, 2011

I am trying to secure very mixed content that is located in an ASP.NET directory. For purposes of this question, it can be ~/MyApp/.

I want all of the content in the directory and its subdirectories restricted to authenticated users. The default.aspx page, though, should be accessible to everyone. This is the web.config in that directory:

[Code]....

Now if you are an unauthenticated user, everything works fine if you request [code]....

The problem occurs in that visitors do not always request "Default.aspx". We have a default document configured so that they get Default.aspx even if they just request "/MyApp". An authenticated user works fine, but an unauthenticated user is directed to the login page.

Now I know that essentially this happens because even though the request for "/MyApp/" will actually end up serving up "/MyApp/Default.aspx", the security system is only checking for "/MyApp/" since that is what I requested. That is then getting the default security for the directory.

How can you configure an exception to allow access when no particular file is requested in the directory??

Is there some dependency between DefaultDocumentModule and UrlAuthorizationModule? In this environment, the UrlAuthorizationModule has been removed and re-added in order to make sure it fires for non-managed requests. I would not expect that to change the order of execution, though, since UrlAuthorizationModule usually goes after DefaultDocument.

A workaround could be to set up the opposite security with the directory being open, and then trying to secure individual files. Because of the (changing) number of files, and extensions, etc, and the fact that you cannot use wildcards in a <location>, this is not really a workable solution for me.

View 1 Replies

Best Way To Rewrite URLs?

Feb 16, 2011

I 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...

View 6 Replies

How To Encrypt URLs In .NET MVC

Dec 16, 2010

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?

View 1 Replies

Why Does The Default Forms Authentication Cookie Have A Leading Period In It's Default Name

Mar 21, 2011

the default ASP.NET Forms Authentication cookie sets it's name as ".ASPXAUTH". Notice the first character is a period? Is there a particular reason for this? Like, does this have an impact on domain names or subdomains for the target domain.

Or is it purely some random thing an MS dev person came up with (maybe to help out the ordering of the cookies, when they were debugging or something .. as text with periods prolly get listed before other strings)?

View 2 Replies

Rewrite Urls Not Working

Feb 17, 2011

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.

View 1 Replies

How To Redirect 404 (bad Urls) To Homepage

Feb 22, 2011

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 Replies

How To Generate The Urls To Map Images

Feb 28, 2010

I 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]...

View 1 Replies

Duplicated URLs With And Without Slash

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

Best Way To Implement Friendly Urls?

Feb 23, 2010

What 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 Replies

Dynamic To Static URLs?

Aug 12, 2010

i 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]

View 1 Replies

Absolute URLs With Redirection?

Dec 2, 2010

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?

View 7 Replies

Checking For Duplicate Urls?

Jan 6, 2010

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.

View 2 Replies

Match Only Extensionless URLs?

Mar 25, 2010

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

View 3 Replies

Use Personalized Urls In Mvc Application?

May 26, 2010

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 Replies

Long URLs From Short Ones Using C#?

Jul 4, 2010

I'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 Replies

C# - Possible To Make User Friendly Urls In A Cms

Jan 4, 2010

I 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 Replies

Webforms 4.0 Routing - How To Get Rid Of Physical Urls

Mar 29, 2010

How 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".

View 2 Replies

C# - Generate Sitemap From URLs In Database?

Oct 20, 2010

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.

View 3 Replies

Notifying Change Of URLs To Users?

Jan 7, 2011

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

View 2 Replies

How To Allow Hyphens In URLs For Mvc 2 Controller Names

Mar 12, 2011

[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)

View 2 Replies

Wildcard Mapping For Extensionless URLs?

Apr 5, 2010

I'm working in a shared hosting environment, so my access to IIS is limited, but I need to know if I even need full access to IIS to use extension-less URLs the way I'm using them.

Basically I'm just calling a RewritePath() in the Application_BeginRequestion() method in the Global.asax.cs file... something like this:

[code]...

will this require Wildcard Mapping in IIS?

View 1 Replies

How To Stop Direct Urls Being Typed In 2.0

Jun 14, 2010

I have a website that has a members section. To view a members profile I pass the username across the query string, but I want to stop direct access by someone changing the url to a different username.

Do I need to encrypt the query string or is there a better way to acheive this ?

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved