Disable navigating site via URL - c#

I've been trying to find the answer to this question in the forum. Maybe I'm not phrasing is correctly when searching, but is there a way to disable the use of navigation of a deployed site through inputing controllers and methods in the url.
In other words, only allowing navigation through buttons in the views.

If you are using this as some sort of security measure you should go stand in a corner and rethink your security-strategy ;)
If not, you could tag-on a session-id or something to every link and button and then verify that in the controller.
I think you should rephrase the question and include why you want to do this, maybe we could help you rethink the whole solution...

Related

Is there a way to post (common post with form) without changing screen position?

I have a general question and I have no code to show (because I wouldn't know what to try).
I have tried to research this, but I guess I'm either not searching for the right keywords (or looking up the right words in my book's index), or such thing doesn't come easily.
All I want to know is if there is a way to post, using the common form method, in WebMatrix (C#) that will not change the position of the screen after post, regardless of what that position may be?
It may not exist, but it seems like it might, and I would hate to think it didn't exist, if indeed it did, just because I couldn't find any topics on it.
Usually you'd use Javascript/Ajax to submit your post asynchronously. But since you asked for the "common post method", which I assume you mean a normal button-click post event, you should check this answer:
ASP.NET MVC3 Razor - Maintain scroll position on postback

Multiple page form in asp.net 3.5

I am trying to design a multiple page web form to collect information from the users. Users can quit at any time and then come back later on the page where they left, I send an email to users containing a link back to their application when they start application process. I am wondering if I can do this with asp:wizard? Does anyone know whether I can use asp:wizard to start from a page where user has left along lets assume 3rd page with their filled data and also when they click back, they should be taken to the prev. page i.e. 2nd page.
I think this is not a good approach. There must be some alternative, that you must try. Nut If this is your requirement, then you might face issues like this
You need to maintain a database of the anonymous users or the users that are using the wizard. Result waste of database sapce.
How would you define that the returning user is the same genuine user , not some bot or hacker. As this might leads make data public. For example you are Akshay , you filled up to wiz#2 and quit. Now next day you want to complete the form. How the system will know u r Akshay Kumar not Sunil Shetty. Also if some Jhonny Lever come and might take a hit and trial on Akshay , then he will get you.
So take a deep thought on the issue and discuss with the seniors regarding the alternatives, also there are lots of SO Guru, which will definitely suggest you some good way out.
I am not using Wizard anymore, but it is possible to go back to any step of the form wizard by using Wizard.MoveTo method. see here

Drag and drop widget code

I have been asked by my boss at work to look into allowing widgets on our home page that can be dragged and dropped and the setup saved for each logged in user (or maybe done by cookies so user doesn't need to be logged in).
Are there any out of the box (preferably free) libraries that can be used? If it requires server side functionality then that's got to be c#/.NET.
I can probably put something together myself but it seemed very much like it is reinventing the wheel. :)
And this is my first question just asking for a recommendation so I'm not sure if this is the right place or if I should put in more details.
An example of the kind of thing I want is http://www.google.com/ig.
And sorry if this isn't a well formed question. I wasn't sure where else or how else to ask it. :)
jQuery & jQuery-UI will do this out of the box if you use the sortable function. The "portlets" demo seems to fit your description. You'll still need to save state manually, but that shouldn't be too difficult with an event listener.
This is a good tutorial of how to build something similar to Google's IG by using ASP.NET AJAX. The source code is a bit outdated, but you can get an idea of what should be done on the client and on the server and re-use the code:
http://www.codeproject.com/KB/ajax/MakingGoogleIG.aspx
Also take a look here:
http://www.codeproject.com/KB/aspnet/drag_drop.aspx

How to call nested views in monotouch?

For example the twitter application you can open one profile and see his tweets then open another profile and go and repeat the same action over and over again, then you can tap on the back button as many times you opened tweets and profiles etc, returning from the same path.
a code example would help me a lot :)
You are looking for examples of a UINavigationController. This allows you to push new UIViewControllers into the navigation hierarchy and helps manage popping the view controllers off when you hit the back button (you can do this programatically also).
There are a bunch of articles on MonoTouch.Info about UINavigationControllers. I think that would be the best starting point for you.

Manipulating page scrolling when returning a View in an ASP.NET MVC site

I'm building an ASP.NET MVC site where I want one of the Views I return to be automatically scroll to a certain point.
The part of the site where I want this to occur works sort of like a forum - there are "threads" that contain "posts". A user can either browse to the whole paginated thread or can browse to a specific post, using its ID. When a user browses to a specific post, I want to show the regular thread interface, then browse to the page that the post is on and scroll down to the post.
Is it possible to somehow automatically scroll down to a certain point when returning a View from an action in an ASP.NET MVC site? If so, how do I do this?
NOTE: One solution to this problem that I've found is how Stack Overflow and the other Stack Exchange sites do it: each answer to a question can be linked to by adding #ID to the URL. If it's impossible to automatically scroll down when returning a View, I would implement this instead, but I don't understand how to use such an approach when there are multiple pages and the post in question isn't on the current page.
UPDATE:
Based on Chris' answer, I'm currently planning to implement it with the URL looking like this: example.com/forum/[ForumID]/thread/[ThreadID]/post/[PostID]#[PostID]. In my Action, I figure out what page of the Thread the Post is on, and then I return all the Posts from that page to the View.
However, I noticed something special in how Stack Overflow solves this problem. Try going to: https://meta.stackexchange.com/questions/57170 - it ends up sending you to https://meta.stackexchange.com/questions/57155/gravatar-bugs-and-improvements-in-chat/57170#57170.
How is the above implemented? This is exactly what I want to accomplish.
You can use javascript in your View to achieve automatic scrolling, with something like the jQuery ScrollTo plugin (http://plugins.jquery.com/project/ScrollTo). Attach it to your page load event and target your desired post.
However, the simplest way (and most cross-browser compatible) would be like how StackOverflow does it, with the #ID in the URL.

Categories