asp.net-mvc

ASP.NET MVC using IIS6: Block access to single view (register)

Hi, We are using MVC on IIS6. Our site is currently being opened up, but we need to restrict access to the register part of the site, but allow those who can register (i.e. from within our offices) still to sign in and use the site fully. So inside office can access register and all other site. Outside office cannot access register and...

Suppressing runtime exceptions in C# for ASP.NET MVC application

How do I suppress an exception in C#? I do not want to enclose it in a try-catch block with an empty catch block - that would defeat the purpose. I have a custom Application_Error handler/listener that checks for HttpException and I would much rather that run automatically than being prompted by Visual Studio for a HttpException and I wo...

.NET MVC - How to create HtmlHelperExtension in VB instead of C#?

Hi, i need to create a HtmlHelperExtension in VB instead of C#. I cannot find any example showing how it's done. Since static classes don't exist in VB (modules are used instead), I'm not really sure on how to create a HtmlHelperExtension... This is what I figured out, but it doesn't seem to work... Public Module HtmlHelperExtensions ...

Can two different URLs be routed to the same view in ASP.NET MVC?

I am just starting to learn ASP.NET MVC and I have a situation where I have two URLs which I would like to point to the same view. For example I could have http://some.domain/reports/daily/team1 and http://some.domain/team1/reports/daily. Could I then point them to the same view as the request is obviously the same? The reason I am ask...

Some classes called +_closure$_x shows up in my ASP.NET MVC projects - what are they?

When adding a new strongly typed view in ASP.NET MVC, these weird classes show up: What are they? ...

ASP.Net MVC: IAuthorizationFilter/Attribute prefered security check for login?

Is IAuthorizationFilter coupled with an attribute the preferred way to check if a user is logged in before a controller runs it's course? Since I'm new to MVC I've been trying to figure out how to handle situations done in WebForms. The one I ran into yesterday is checking to see if the user is able to view a page or not depending on w...

How to position a line below a group of tags?

I am trying to position a horizontal line under a group of tags on an app done on asp.net mvc. I believe I have to do that on the CSS but I just can't seem to find the right way to place such line. Every time I try, the line ends up at the right of the tags and I don't feel like using a whole bunch of is the right way by far. <div id=...

Virtual Earth and ASP.NET MVC

I would like to use Virtual Earth on an ASP.NET MVC application for a client. What are the licenses available for commercial use? Also, does anyone have a good example? I tried a few examples but they always end with 'Object is null' error in the java script code. Thanks in advance. ...

ASP.NET MVC Versioning Issue

I have a web application with a couple different sub-webs that use MVC. The problem I'm running into is that two of the sub webs use different MVC versions. One was recently upgraded to use the 1.0 version, and one is stuck on an earlier preview version. After upgrading one of the sub-webs to 1.0, the other web that is using the previ...

Where should I include a javascript reference for a view that inerhits from a Master view in ASP.NET MVC?

I have a bunch of pages inheriting from a master view. One one of these pages I want to use a popular jQuery plugin called "Uploadify". Where should I place the reference for the Uploadify javascript file? I only need it on one small page so it didn't seem right to place it in Master view. Is it 'Ok' to place it in the content tag ...

Rendering partial views (modal windows) in asp.net MVC

Sorry for the poorly-worded question. I was hoping to get everyone's ideas on the best way to handle this. I have a link on a master page that links to a contact form. If the user has javascript enabled, I want to open the form ion a modal window using jQuery. If not, the user will just be directed to the contact form page. The issu...

Programmatically submitting a Microsoft AJAX form

I'm using ASP.NET MVC and Microsoft AJAX to create an AJAX form using this following syntax: using (Ajax.BeginForm()) { ... } This works fine if the user clicks a submit button. However, I also need to programmatically submit the form. The problem is, the way MS AJAX works (for reasons that escape me) is that it puts the submit acti...

ASP.NET MVC & SQL Server Reporting Services

I am getting started with ASP.NET MVC. Is it easy or even possible to use the ReportViewer in MVC as you can with webforms? If not, what can be done? ...

Problem with "Security" and the ASP.NET Routing Engine

I´m developing an ASP.NET Web Application and want to use the ASP.NET Routing Engine (System.Web.Routing) with it. My Application works fine in Cassini, but when I start it in IIS7 (Integrated Application Pool, of course) I always get an error on this line: User.Identity.IsAuthenticated What could be the reason for this? Is there an...

How can I detect if Flash is installed and if not, display a hidden div that informs the user?

How can I use javascript/jQuery/etc to detect if Flash is installed and if it isn't, display a div that contains information informing the user that they need to install flash? ...

How can I access the entire query string in an ASP.net controller action

I know that if I have an url like XController/Action?id=1, and an action method void Action(int id) the id parameter will automatically read from the query string. But how can I access the entire query string when I don't in advance know the name of all parameters. E.g: void Action(QueryStringCollection coll) { object id = coll...

Add simple server-side scripting to ASP.NET

I need a simple server-side scripting solution for the following problem: My client has me making a site in ASP.NET MVC. I'm coding the whole site but there's a section they want to be able to expand later via simple scripting. For example: When is your birthday? __/__/____  [x] Don't display the year This needs to take a title (...

ASP.NET MVC HandleError not working (customErrors is set to "On")

I believe I have set up our MVC app to use [HandleError] properly. This is my controller: [HandleError] public class SupportController : BaseController { public ActionResult Toss() { throw new Exception("uh oh"); } // snip } And I have set my customErrors tag in web.config to "On": <customErrors mode="On"></custo...

JSON request failing because of line breaks, how to escape them?

Hi, My JSON request seems to be failing because of line breaks (I am programatically weaving my own JSON string). How can I escape for line breaks? {"rc": "200", "m" : "", "o": "<div class='s1'> <div class='avatar'> <a href='\/asdf'>asdf<\/a><br \/> <strong>0<\/strong> ...

Using json.net, how would I construct this json string?

Hi, I was weaving my own json programatically, and was adviced to not roll my own as escaping for the forward slash and line breaks won't be enough basically. My json is to look like: {"rc": "200", "m" : "", "o": "<div class='s1'> <div class='avatar'> <a href='\/asdf'>asdf<\/a><br \/> ...