Thursday, December 30, 2010

customErrors defaultRedirect does not work with authentication problems

ASP.NET has a custom error message feature that sometimes does not work. A default generated error page is displayed even if your web.config file includes this configuration:

<customerrors defaultredirect="InternalError.htm" mode="On" />

Microsoft documentation explains it very well, except this detail that I ran into and want to explain here: a custom error page specified in defaultRedirect must be available to unauthenticated uses, otherwise a default generated error page is displayed if an error happens before a user is authenticated. I add the following section to web.config to make it work

web.config snippet:

...
<system.web>
...
<customErrors defaultRedirect="InternalError.htm" mode="On" />
...
</system.web >
...
<!--
this is necessary to allow user to see error page even if they are not logged in
for example this happens when database server is unavailable
-->

<location path="InternalError.htm" >
<system.web>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
</location>

Tuesday, January 5, 2010

How to blog via url

The URL below will open Blog Post entry form with Title "How to blog via url", message "I blogged about blogging", URL and default Blog to Post to selected ("Play and Learn").

How to blog via url: "I blogged about blogging"


http://www.blogger.com/blog-this.g?u=http://regmagik.com&n=How+to+blog+via+url&t=I+blogged+about+blogging&blogID=6694738083154631520

How to blog via url

How to blog via url:

This url combines blog to post to, title, message and URL that is embedded in a message.
http://www.blogger.com/blog-this.g?u=http://regmagik.com&n=How+to+blog+via+url&t=I+blogged+about+regmagik&blogID=9633914

Monday, January 4, 2010

Created to test multiple blogs per user account

Now, let's try to post via URL and see what happens.

This link has blog ID, but no default title and body. How to add default title, body etc?

http://www.blogger.com/post-create.g?blogID=6694738083154631520