Not Equal C && !=C && 不等于西
RSS icon Email icon Home icon
  • MVC3 with IIS7 credential error

    Posted on March 19th, 2012 Sean Add comments

         When I deploy my new MVC 3 project to a Windows 2008 R2 with IIS 7 server, I got an error with “401 – Unauthorized: Access is denied due to invalid credentials” on every page.
         After some google’s, I figure out the reason was: in my “_layout” page, I have the code “@Html.RenderAction(…)”, and the action I was trying to render actually is under “Home” controller with “[Authorize]” attribute. In another word, when IIS calling MVC pages, ASP.NET will ask for authentication, and if not authenticated, it’s supposed to redirect to “_logon” page, but unfortunately the “_logon” page (which is using “_layout” as master page of cause) also asked for authentication because of rendering action. It became to a dead end.
         Based on the reason explained above, the fastest solution is remove the “[Authorize]” attribute from the controller. But if you don’t want change your code, go to IIS management tool, select the website your are running, choose “Error Pages”, and “Edit Feature Settings”, change “Error Responses” to “Detailed errors”.

  • 1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
    Loading...Loading...
    171 views
  • SyntaxHighlighter language “brush” list

    Posted on March 10th, 2012 Sean Add comments

         Seems like code highlighter will be very useful, but sometimes it’s hard to remember all “brushes” and their “aliases”. Save to here just for my own records.

    Brush Name Brush Aliases
    ActionScript3 as3, actionscript3
    Bash/shell bash, shell
    ColdFusion cf, coldfusion
    C# c-sharp, csharp
    C++ cpp, c
    CSS css
    Delphi delphi, pas, pascal
    Diff diff, patch
    Erlang erl, erlang
    Groovy groovy
    JavaScript js, jscript, javascript
    Java java
    JavaFX jfx, javafx
    Perl perl, pl
    PHP php
    Plain Text plain, text
    PowerShell ps, powershell
    Python py, python
    Ruby rails, ror, ruby
    Scala scala
    SQL sql
    Visual Basic vb, vbnet
    XML xml, xhtml, xslt, html, xhtml
  • 1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
    Loading...Loading...
    136 views