Showing posts with label HTML. Show all posts
Showing posts with label HTML. Show all posts

20 June, 2018

Deploying a Web Application using IIS, HTTP Error 401.3 Solved

IIS 7's redesigned management console
IIS 7's redesigned management console (Photo credit: Wikipedia)
Deploying a web application using IIS in Windows was a problem for me after I have completed the task of developing the web app. Publishing it is easy following the File System or FTP method. And there are many articles that you can find on the web telling the same thing.

So why doesn't the web application run right away?

Here's my application structure:
The simple web application I created used bootstrap and CSS, and some jQuery and Javascript functions. It uses some database tables running in MSSQL Express. Now if I remember, I have set up my MSSQL Express to run on mixed authentication mode.

I checked my connectionstring values, and everything seems to be in place. In fact, I am able to perform web application deployment smoothly. Only that I get into an error when I click on a page that accesses the database. Even just querying data and no transactions yet.

I asked a fellow developer, and I was told to add in a logger. That is to help me identify what wrong thing could be happening that isn't normally seen or shown.

But I didn't do that. I am already so close and getting impatient. All static pages working, and only those dependent on the database have issues. I was near to pulling my hair!

But my patience took the better of me. I continued searching, and I found some more articles, randomly, which I tried one by one.

That fixed the issue, and I was able to run the web application if full spectrum.

Here's what I have done, and hopefully, it would help others, too.

1. The usual web application deployment methods, but in my case, File System.
2. In particular, I get HTTP Error 401.3 - Unauthorized: Access is denied due to an ACL set on the requested resource.

Now remember, MSSQL Server was set up using mixed authentication mode, so I have sa account and also Windows account. The latter is the key. Windows account is not authorized, so database access fails.

What's the fix?

Open up IIS Manager (type 'inetmgr' in Cortana/search box).
Open up Sites, then click on the Web Site you are fixing.
In the middle pane, under IIS section, double-click on Authentication.
Right click on Anonymous Authentication, then select Edit.
Instead of Application pool identity, select now Specific user and specify IUSR (or IIS_IUSR).
(In some cases, selecting Application pool identity would do the trick.)
Click on Set and enter the credentials, if needed.
Then OK.

Now go back to the folder where the web site is deployed and give proper priveleges for the IUSR account. For my case, that is what fixed the problem. So I'm logging this discovery via my blog.

Anyway, if this doesn't work, it is 99.99% an issue of the account being used to access the database that is the cause, so just play around these settings. So much so if all static pages already work.

Hope it helps others, too.

Till then!

23 May, 2018

Enable the Design and Split Buttons in Visual Studio

23-May-2018

The ActiveReports designer as it appears in Vi...
The ActiveReports designer as it appears in Visual Studio, with important areas labeled. (Photo credit: Wikipedia)
Enable the design and split buttons in Visual Studio. That was something that I needed to do about a month ago as I was tasked to create a small web application, a submodule of a bigger application. But only source view is enabled and is the default.

So how to enable it?

2 ways:

First Way:
Click on File >  New > File
Choose General on the left pane, then HTML Page at the middle pane.
At the bottom right area of the New File dialog, click on the down-pointing arrow beside Open.
Click on Open With.
Select HTML (Web Forms) Editor, then on the right side, click Set as Default.
Click on OK.

No, that may not show the Design | Split | Source buttons yet. You need to restart Visual Studio first.

Second Way:
Click on Tools > Options > Web Forms Designer
Make sure box on Enable Web Forms designer is ticked.
Start pages in Source View, Design View, Split View, you choose that.
Click on OK.

Again, that may not show the Design | Split | Source buttons yet. You need to restart Visual Studio first.

Hopefully, one of these methods would enable the design and split buttons in your Visual Studio.

Till then!

02 January, 2013

My Automated Change Request Web Apps

02-Jan-2013

The last weeks of December, 2012 was very encouraging. I stopped posting articles on my blogs somewhere in the middle of the year as I was too tied up with my small projects, and while many did not materialize due to resource issues, the very critical ones did come through.

And that was not without the many searches I did in the web, and the many articles I’ve come across with, and the very thorough filtering of what is needed, until finally - the fully operational, fully functional, working to the last letter of the specification – the intranet web apps was deployed.

And starting here, I will detail out the sections, and the web pages that I referenced for the parts and pieces required that made up the whole.

This is my project: Automated Change Request System.
Enhanced by Zemanta

12 April, 2011

Fonts to Use, in Web and in Print

Cover of "Looking Good in Print"Cover of Looking Good in PrintI've been reading the books by Charles Wyke-Smith, and once again, I have come across the idea of what font is suited best for which application.

I read it long time ago in 'Looking Good In Print' - a book that tells how to style and arrange a page, and what fonts to use, on the title, the text, the headers and footers - everything you need to know and do when it comes to printed materials, and the one thing that I can remember well from that book is when it said that the font best suited for printed matters is serif fonts.

I could have easily made the mistake of saying that that idea was confirmed in one of Wyke-Smith's books, but fortunately, I checked back again.

The book that I have just finished reading, which confirmed that idea is the book by w3schools.com: "Learn HTML and CSS with w3schools" and "Learn CSS with w3schools".

To recap, here's what it said:

For the Web, use sans serif, font size about 12.
For Print, use serif fonts, using smaller font size of about 10.

And this is done by using the '@media' style selector.

Till then!

Learn JavaScript and Ajax with w3SchoolsLearn HTML and CSS with w3SchoolsLearn CSS with w3Schools

Enhanced by Zemanta

09 March, 2011

String to StringBuilder conversion - a pitfall

If you've known that the way to go is by using StringBuilder instead of String, due to its memory use advantage, beware.

The coder's ease in using String isn't quite as straightforward when it comes to StringBuilder.

Below is one example where the code change is non-glaring, but the impact can be disastrous.


    Dim myStringBfr As String = ""

    myStringBfr += ""
    myStringBfr += "Some text to go here. "
    myStringBfr += "Some more text to go here. "
    myStringBfr += "Final text string to be added goes here. " & vbCrLf
    myStringBfr = myStringBfr + " - string concatenation ends here - "

    Console.WriteLine()

    Console.WriteLine(myStringBfr)


Common conversion happens this way (at least for my case)
  1. Change in declaration
  2. Change in assignments
  3. Change in method calls

    Dim myStringBldrBfr As New StringBuilder

    myStringBldrBfr.Append("")
    myStringBldrBfr.Append("Some text to go here. ")
    myStringBldrBfr.Append("Some more text to go here. ")
    myStringBldrBfr.Append("Final text string to be added goes here. ").AppendLine()
    myStringBldrBfr.Append(myStringBldrBfr).Append(" - string concatenation ends here - ")

    Console.WriteLine()

    Console.WriteLine(myStringBldrBfr.ToString())
    'Console.WriteLine(myStringBldrBfr) also works


When you try to run this very simple demo by creating a console application and typing in these few lines, the output will be like below:


"
Some text to go here. Some more text to go here. Final text string to be added goes here.
 - string concatenation ends here -

Some text to go here. Some more text to go here. Final text string to be added goes here.
Some text to go here. Some more text to go here. Final text string to be added goes here.
 - string concatenation ends here -
Press any key to continue . . .
"

Suggestions:

Avoid the Double Append call:
myStringBldrBfr.Append(myStringBldrBfr).Append("...
should be written as
myStringBldrBfr.Append("...

Reset or initialize the StringBuilder var
Instead of doing myStringBldrBfr.Append(""), set the length to zero.
myStringBldrBfr.Length = 0

As much as possible, define and use a local-scope variable. when it cannot be avoided, or that the overall impact of using StringBuilder is significant, then define and use a global-scope var.

This is especially true if you are using your SB var in a loop. Make sure that once the SB var is used, set the length to zero (0) to clear its contents, or the value is simply carried over and over again, the impact of which who knows?


Below is the corrected code, and the output is the same as when you used String:


    Dim myStringBldrBfrFin As New StringBuilder

    myStringBldrBfrFin.Append("Some text to go here. ")
    myStringBldrBfrFin.Append("Some more text to go here. ")
    myStringBldrBfrFin.Append("Final text string to be added goes here. ").AppendLine()
    myStringBldrBfrFin.Append(" - string concatenation ends here - ")

    Console.WriteLine()

    Console.WriteLine(myStringBldrBfrFin.ToString())
    myStringBldrBfrFin.Length = 0



Hope this code nugget is of help to those who need it most.
Till then!


Enhanced by Zemanta