ASP.NET forms authentication keeps displaying login page on iPad

ASP.NET forms authentication keeps displaying login page on iPad, when I was developing iPad web app, I have come across one of the bug that once we "Add as Home Screen" then we can create Web as App then once you have logged in then when we try and go through website somewhere it automatically clears the session out so then I have found out the solution, that we need to make changes inside web.config file and I had my my web.config file as following:

<authentication mode="Forms">
  <forms loginurl="/Account/LogOn" />
</authentication>

 Then, I have found out, and I have added timeout="2880" cookieless="UseCookies" as following: 

<authentication mode="Forms">
  <forms loginurl="/Account/LogOn" timeout="2880" cookieless="UseCookies" />
</authentication>

and it will start getting it working and you will not loose session.

If you have question don't forget to ask.

Thank you for going through

View iPad Websites via Firefox Web Browser

Curious to see what iPad websites look like without an iPad? If you have Firefox installed on your computer, download the User Agent Switcher add-on and create a new iPad user agent profile, so you can view iPad websites on your desktop with the Safari browser of Apple iPad, just get the desktop version of Safari and change the user-agent of Safari to that of iPad.

Here's the fulluser agent string of iPad

Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 
(KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10

Chrome users (Linux/Windows) can can easily change their user agent by launching Chrome with the following user agent string:

-user-agent="Mozilla/5.0(iPad; U; CPU iPhone OS 3_2 like Mac OS X; en-us) 
AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10″

 hope this artilce helps! :)

Thank you

Show pound (£) sign in input field by JavaScript or jQuery

Show pound sign in input field by JavaScript or jQuery

Pound sign in input field by JavaScript or jQuery, if anyone has tried pound (£) sign (or any special character) in any input fields by JavaScript or jQuery, then you know it is not straight forward.

 

If we write code like this,

//JavaScript
document.getElementById('input_filed_id').value = '£100';

//jQuery
$('input_field_id_OR_class').val('£100');

It'll display some question mark(unrecognized character) instead of the pound sign.

So we need to put character's Unicode to display it properly. In this case, the code should look like this:

//JavaScript
document.getElementById('input_filed_id').value = '\u00A3100';

//jQuery
$('input_field_id_OR_class').val('\u00A3100');

where \u00A3 is the character code of £

Thank you and have nice day

Set Umbraco Folder Permissions from command line

Morning,

Today, I have faced new issue with folder permission in Umbraco, recently we have set-up new Windows 2008 Server with IIS 7 and there was issue with Folder permission, then I have searched on it and found out from Umbraco Wiki following article.

Execute following code from Command Line inside the root directory of installation (Note: Make sure you run command line with administrator permissions)

REM icacls . /grant "NETWORK SERVICE":(OI)(CI)M
icacls app_code /grant "NETWORK SERVICE":(OI)(CI)RX
icacls app_browsers /grant "NETWORK SERVICE":(OI)(CI)RX
icacls app_data /grant "NETWORK SERVICE":(OI)(CI)M
icacls bin /grant "NETWORK SERVICE":(OI)(CI)R
icacls config /grant "NETWORK SERVICE":(OI)(CI)M
icacls css /grant "NETWORK SERVICE":(OI)(CI)M
icacls data /grant "NETWORK SERVICE":(OI)(CI)M
icacls macroScripts /grant "NETWORK SERVICE":(OI)(CI)M
icacls masterpages /grant "NETWORK SERVICE":(OI)(CI)M
icacls media /grant "NETWORK SERVICE":(OI)(CI)M
icacls python /grant "NETWORK SERVICE":(OI)(CI)M
icacls scripts /grant "NETWORK SERVICE":(OI)(CI)M
icacls umbraco /grant "NETWORK SERVICE":(OI)(CI)M
icacls usercontrols /grant "NETWORK SERVICE":(OI)(CI)R
icacls xslt /grant "NETWORK SERVICE":(OI)(CI)M
icacls web.config /grant "NETWORK SERVICE":(OI)(CI)M
icacls web.config /grant "NETWORK SERVICE":M

 

Note: If you are using Windows 2008 Server/IIS 7.0 or newer then will need to add IIS_USRS or Application_Pool_Name as below

REM icacls . /grant "IIS_IUSRS":(OI)(CI)M
icacls app_code /grant "IIS_IUSRS":(OI)(CI)RX
icacls app_browsers /grant "IIS_IUSRS":(OI)(CI)RX
icacls app_data /grant "IIS_IUSRS":(OI)(CI)M
icacls bin /grant "IIS_IUSRS":(OI)(CI)R
icacls config /grant "IIS_IUSRS":(OI)(CI)M
icacls css /grant "IIS_IUSRS":(OI)(CI)M
icacls data /grant "IIS_IUSRS":(OI)(CI)M
icacls macroScripts /grant "IIS_IUSRS":(OI)(CI)M
icacls masterpages /grant "IIS_IUSRS":(OI)(CI)M
icacls media /grant "IIS_IUSRS":(OI)(CI)M
icacls python /grant "IIS_IUSRS":(OI)(CI)M
icacls scripts /grant "IIS_IUSRS":(OI)(CI)M
icacls umbraco /grant "IIS_IUSRS":(OI)(CI)M
icacls usercontrols /grant "IIS_IUSRS":(OI)(CI)R
icacls xslt /grant "IIS_IUSRS":(OI)(CI)M
icacls web.config /grant "IIS_IUSRS":(OI)(CI)M
icacls web.config /grant "IIS_IUSRS":M

 

Note: python directory permission would only be for earlier version of Umbraco, I mean before Umbraco 4.7 and miceroScript directory permissions would be for Umbraco 4.7 or newer version.
If you like this post please don't forget to share with your friends via Facebook, Twitter,  LinkedIn, Google+, etc

Thank you,
Have good Day

 

Convert Text into Image using C#

Hi there,

I was thinking to do something interesting about embedding fonts to a website. I was trying to embed fonts in website then I thought of converting Text into image here below you can convert the text into image.

    private Bitmap CreateBitmapImage(string TextImage)
    {
        Bitmap objBmp = new Bitmap(1, 1);

        int Width = 0;

        int Height = 0;

        // Create the Font object for the image text drawing.

        Font objFont = new Font("Arial", 20, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel);

        // Create a graphics object to measure the text's width and height.

        Graphics objGraphics = Graphics.FromImage(objBmp);

        // This is where the bitmap size is determined.

        Width = (int)objGraphics.MeasureString(TextImage, objFont).Width;

        Height = (int)objGraphics.MeasureString(TextImage, objFont).Height;

        // Create the bmpImage again with the correct size for the text and font.

        objBmp = new Bitmap(objBmp, new Size(Width, Height));

        // Add the colors to the new bitmap.

        objGraphics = Graphics.FromImage(objBmp);

        // Set Background color

        objGraphics.Clear(Color.White);

        objGraphics.SmoothingMode = SmoothingMode.AntiAlias;

        objGraphics.TextRenderingHint = TextRenderingHint.AntiAlias;

        objGraphics.DrawString(TextImage, objFont, new SolidBrush(Color.FromArgb(102, 102, 102)), 0, 0);

        objGraphics.Flush();

        return (objBmp);
    }

 

If you like this article, please don't forget to like and share with people.

Enjoy your day.

Text to Speech in ASP.NET with C#

Hi there,

I hope you guys had nice week, Its Saturday wasn't working but when I was having bath and thought of doing something interesting then I was working during the week on text to speech and thought of doing simplest and smallest code for text to speech. I'll go through in step by step in below section:

 

Step 1: Just create website.

 

Step 2: In the website just creates one page or you will already have default.aspx in side it, we have to create on text box in which person can write any text, also a button to click once you finish entering text and it will enable windows speech libraries. Please write following code to start with inside default.aspx.

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Text to speach</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:TextBox ID="txtspeech" runat="server"></asp:TextBox>
        <br />
        <asp:Button ID="clickToSpeech" runat="server" Text="Speech" OnClick="clickToSpeech_Click" />
    </div>
    </form>
</body>
</html>

 

Step 3: Right click to solution explorer of the visual studio and add reference of SpeechLibrary. In the reference dialog box select the COM tab and add the "Microsoft Speech Object Library" and click ok. Now you will see in the references folder of your solution explorer "SpeechLib".

 

Step 4: And in code behind of Default.aspx which is Default.aspx.cs file, copy the following code.

using System;
using SpeechLib;

namespace Text_to_speech
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void clickToSpeech_Click(object sender, EventArgs e)
        {
            SpVoice objspeach = new SpVoice();
            objspeach.Speak(txtspeech.Text.Trim(), SpeechVoiceSpeakFlags.SVSFDefault);
            objspeach.WaitUntilDone(System.Threading.Timeout.Infinite);
        }
    }
}

 

Step 5: Now run the code

And enter the text that you want and hit speech then you will listen the text

 

It was good weekend day for me to write little bit of brief explanation of text to speech.

If you like article, please don't forget to share or like this article.

Thank you

Potentially Dangerous Request.Form Value Was Detected From The Client

Hi Everyone,

I was trying to create new RichTextEditor in one of my project and was using textarea or <asp:Textbox ……> and it has some of the scripts that I needed to use and then what happened was that I couldn't do it because it had an script and some of the Html elements so then I got error like "Potentially Dangerous Request.Form Value Was Detected From The Client" here below is an error:

First-Step

To deal with this you have to disable ValidationRequest feature. You have to disable this because validation is done by ASP.NET while executing code by disabling it will not validate, means will not check for scripts and html into inputted script. <%@Page directives ValidationRequest="false", Or you can disable it for enter application from web.config file. 

<configuration>
    <system.web>
        <pages validateRequest="false" />
    </system.web>
</configuration>

 If you are running on .NET framework 4.0 make sure you have to add requestValidationMode as well

<configuration>
    <system.web>
        <httpRuntime requestValidationMode="2.0" />
    </system.web>
</configuration>

Then it would solve your problem and it has solved my problem as well.

I hope it would have solved your issue if you looking for same issue. Also, don't forget to share and like on social media.

Thank you,

CSS3 multiple gradient background in div

Good afternoon,

Today, I was working on some of the design with HTML5 and CSS3, and I had to deal with gradient. The situation was that I had to do two gradients without using background image, so I have looked into W3C standard and found out that we can have two, not two but as many gradients we wanted, it wasn't complicated but it was quite useful.

I have setup that into normal div and placed gradient as following:

Below is HTML div with id="db" and I are going to place gradient into it.

 

<div id="db"></div>

 

Now, do some CSS3 code which would generate multiple gradients inside div tag as following: 

 


#db {

    /* IE6-9/Chrome < 10 */
    background-color: #E0DFDE;

    /* IE10 */
    background-image: -ms-linear-gradient(left top, #E0DFDE 15%, #3D668F 50%, #E0DFDE 85%);
    /* Mozilla Firefox */
    background-image: -moz-linear-gradient(left top, #E0DFDE 15%, #3D668F 50%, #E0DFDE 85%);
    /* Opera */
    background-image: -o-linear-gradient(left top, #E0DFDE 15%, #3D668F 50%, #E0DFDE 85%);
    /* Webkit (Safari/Chrome 10) */
    background-image: -webkit-gradient(linear, left top, right bottom, color-stop(0.15, #E0DFDE), color-stop(0.45, #3D668F), color-stop(0.85, #E0DFDE));
    /* Webkit (Chrome 11+) */
    background-image: -webkit-linear-gradient(left top, #E0DFDE 15%, #3D668F 50%, #E0DFDE 85%);
    /* Proposed W3C Markup */
    background-image: linear-gradient(left top, #E0DFDE 15%, #3D668F 50%, #E0DFDE 85%);

    height: 300px;
    width: 300px;

}

 

The reson behind I have wrote this codes because all the browsers dones't support the way W3C markup works because it is just proposed mark-up they haven't started implemeted it yet and because of that we have to add for all the browsers and also we can do something for non-supported CSS3 browsers like IE6-9, Chrome before 10, should write background-color, above I have #E0DFDE color in case of non-supported browser it will not fall apart. this example only works for supported browsers.

 

Result of above example is as following:

CSS3-multiple-gradient-as-background

 

If you think that helped you please don't forget to rate and share via Facebook, Twitter, LinkedIn, etc.

Enjoy your day and have nice easter weekends.

Data binding not binding after submit or page refresh C#.NET or VB.NET

Today,

I have started building application and stuck in problem.

I have bind data with Repeater using DataTable it was binding on first Page_Load but when I hit submit button, it was calling another method which called repeater and getting user selection from it. But Repeater that I was getting was empty.

Then I have figured it out that EnableViewState was false, so I have added that in @Page directives EnableViewState="true". or can change from the web.config in to system.web in pages section as below:

<system.web>
   <pages enableViewState="true"  />
</system.web>

Again, I have tried running code but it didn't work for me. Then I did some trial and error for it the I have fingured it out that I didn't write on Page_Load event that it shouldn't be PostBack. So I have written following code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace ExampleOfRepeaterBinding
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //Repeater binding code
            }
        }
    }
}

 

If you think that helped you please don't forget to rate and share via Facebook, Twitter, etc.

Enjoy you day and have nice weekends.

Welcome

Hi there! , welcome to your new iWeb Zone Code Simplicity

 

  1. By getting solution which is much reliable and simplicity of code will lead you to the new way of simplified coding styles.

    Go to www.iweb-zone.com

  2. Also, you can visit our aim and history of web zone from about us section /about/

    Go to the About section

  3. why not go to our previous topics and find something exciting, amazing and new approch. /archive/

    Go to the Previous Topic

  4. Also, you can visit out keyword tag cloud from /tag-cloud/

    Go to the Tag Cloud

  5. If you want to embad blog, here us link for rss feeds /rss 

    Click here for RSS Feed