Category Archives: IIS 7

[RESOLVED] Hosting 4.0 web application

i tried to implement url routing feature in 4.0 and tried to host in my machine in IIS. but i get an error.

HTTP Error 404.0 - Not Found

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

The code i used

protected void Application_Start(object sender, EventArgs e)

void CustomRouteTable(RouteCollection routes)

            routes.MapPageRoute("Telugu", "Movie/Telugu", "~/Telugu/Telugu.aspx");


and one in default.aspx page and on click of the button i wrote:

protected void btnTelugu_Click(object sender, ImageClickEventArgs e)

is it due to the page is kept inside the Folder in my application???

How to handle this scenario???

Thanks...Please guide me...

Are you certain that IIS is set up to host .net 4.0?

Check your IIS setttings. 

How to know whether the IIS is set up to host .net 4.0???

what are the steps?? Could you guide me???

I had made the application pool ->Asp.net4.0

should i select application pool-> Asp.net4.0 classic  ???

If you are using IIS 7 then yes, I always switch to Classic, while developing in VWD2008.

Classic has worked for me. 


Let me check into my server settings I will try to post later.



Under web sites in IIS 6, look at properties then on the folder tab, be certain you first have .net 4.0 available.

I don't know of setting in IIS6 App Pool for level.


i could solve the issue with applying the below code in my web.config file...

    <modules runAllManagedModulesForAllRequests="true">

      <add name="UrlRoutingModule"
                   System.Web.Routing, Version=,
                   PublicKeyToken=31BF3856AD364E35" />
      <!-- ... -->


      <add name="UrlRoutingHandler"
            verb="*" path="UrlRouting.axd"
                  System.Web, Version=, Culture=neutral,
                  PublicKeyToken=b03f5f7f11d50a3a" />
      <!-- ... -->


but i have two more issue....

1) i am not able to make url setting for Default.aspx page which is start page...i am also getting Default.aspx ( with extension)

2) how to navigate from HTML side??

Not required if you are running .net 3.5 it is backward compatible and will support 2.0


Can you help me to find out the ans for above 2 question which i posted ? 

Check out som eof the VIDEOS at this link

There are white papers and videos, search for the videos for a faster start.




  Thanks..I could get the issue resolved for ul and li with the help of ResolveUrl approach.

[RESOLVED] Redirect to default page - canonical problem


When I tested web site on SEO Tools in IIS7 I get this SEO Error:


The page contains multiple canonical formats.

The page with URL "" can also be accessed by using URL "".
Search engines identify unique pages by using URLs.  When a single page can be accessed by using any one of multiple URLs, a search engine assumes that there are multiple unique pages. Use a single URL to reference a page to prevent dilution of page relevance. You can prevent dilution by following a standard URL format.

Recommended action:

Pick a canonical URL format for your site and then ensure that all the links in your site follow that format. (For example, always use lowercase letters.) If an external link that points to your site does not use the canonical URL format, use permanent HTTP redirection to redirect site visitors and search engines to a canonical equivalent of that URL.


I tried to solve this by redirect page to a default.aspx. The problem is that HttpContext.Current.Request.Url.ToString(), always shows "". So I can't detect if url typed in browser is only or

I know that that can be solved in IIS7, but I can't access it to do that in hosting server.

Is any solution in ASP.NET to redirect to default page any time when in browser is typed only domain name?



Add the name of the page Default.aspx in the IIS Manager >> Your domain >> Default Document


If your site is running on IIS 7, you can use the Url re-write module to fix that.  It even has a rule wizard for working with canonical formats, so you should be up pretty quickly.

Check out this post.



[RESOLVED] Visual Studio 2010 [Server Error in "" Application]

My web application runs on a Hosted Environment.  Unfortunately, the Host environment has an Idle timeout of 20 minutes.

so, naturally, I put an expiration timer in the footer area of my Master Page, and if the timer expires, i use a Response.Redirect("SessionTimedOut.htm", false); method.

While running VS 2010 in Debug Mode, when the timer expires, i get:

Server Error in '/' Application.

HTTP Error 400 - Bad Request.

Please keep in mind that after publishing the same build, the host site works fine.

there's just something about how VS2010 installed (less than a week old) which makes the environment different from the prior VS2008 installation which runs on a different box.

this may be a clue:  I'm now running an a Acer Laptop Windows 7, 64Bit

Try turning customErrors = off in your web.config file temporarily.

This will at least enable you to see exactly where the code is going wrong, or, allow the people here to see what's going on. Maybe post the offending code too?

i get the same as I originallly did before trying Custom Errors, i.e.,

Version Information: ASP.NET Development Server

I'd be happy to post whatever you think is required.  Web.Config?  What else?

Server Error in '/' Application.

HTTP Error 400 - Bad Request.

I think this problem is because of IIS create a new application pool for 4.0 and then put the website in it....and also try be resetting and re-starting IIS....

And also there will be changes in web.config if you are migrating from 3.5 to try to comment the doubtful sections in web.config and try...

PS - I gave the above answer assuming that that the website is running perfectly in dev environment....

I would agree that the problem certainly has characteristics of IIS.

But, I have no IIS installed on this particular machine, and rely on Visual Studio 2010 to provide whatever it needs to run an application in Debug Mode.

So we're back to a further filtration of the original question:

What options [in an out of the box installation of Visual Studio 2010 Professional] must be added or set differently in order to resolve this 'Server Error in "/" Application' issue?


After looking into your suggestion, I believe you are correct as described here:

The link I posted provides the solution.  Remember that this is just a temporary workaround until Scott and his ninja team release a hotfix for Visual Studio to enable native IIS Express integration.

It really works, and when you are done constucting it, your debugging steps will change to
1) Start IIS Express in command window with Shortcut built, then repeatedly: 
1.a) Build your Debug solution (as before)
1.b) Publish your Debug Solution to the IIS 7.5 C:\inetPub\Dev Directory
1.c) F5 to begin the Debug Session
1.d) F4 to run the Macro to Attach Debugger.LocalProcesses to IIS Express
1.e) Debug your solution as usual
1.f) End Debug Session
2) End IIS Express in command window

[RESOLVED] FileUpload permissions issue

I'm using the FileUpload control to upload a file, read it into a byte array and store it in a database table.  Everything works perfectly running it locally on my development machine.  However, on the web server deployment, I keep getting "access denied" excpetions.  I've tried granting full control permissions to the NETWORK SERVICE account and to the IIS_IUSRS group, but no luck.  My app is using Windows authentication and the web server is running IIS 7.0.  Any suggestions will be greatly appreciated.

- Robert -

If the impersonation is off, have you tried giving full control to ASPNET account.


My app is using Windows authentication

Try adding Authenticated Users in the list of users in folder's Security Tab.


I'm using the FileUpload control to upload a file, read it into a byte array and store it in a database table.  Everything works perfectly running it locally on my development machine.  However, on the web server deployment, I keep getting "access denied" excpetions.  I've tried granting full control permissions to the NETWORK SERVICE account and to the IIS_IUSRS group, but no luck.  My app is using Windows authentication and the web server is running IIS 7.0.  Any suggestions will be greatly appreciated.

- Robert -



With the help of process monitor from, you can set that user access because the user account depends on the Server‘s configuration. The other solution is to try to decrease the trust and privileges of ASP.NET applications. The application pool identity is not granted sensitive privileges or unnecessary rights to access resources.

It would be better to visit this link, where you can get the solution on the “Reduce Trusted”:

OK, it turns out that my problem really wasn't specific to folder permissions on the web server, but rather the way I was using the FileUpload control.  Since I was missing the FileUpload.PostedFile.SaveAs() step to write the file to the server, my attempt to read the file from FileUpload.PostedFile was failing because the server could not access the local path from where the upload originated.

Sorry for the confusion, but hopefully this experience may enlighten some other developers out there who are attempting to do the same thing.

- Robert -

[RESOLVED] Server Error in '' Application during upload image

hi dears,

My site without any problems at localhost would upload images,

But after uploading it on the Internet, when I upload images I get the following error encountered :

 i am use a use control for upload image.

image and Folders folders are in main directory of my site

a part of code is :

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.UnauthorizedAccessException: Access to the path 'D:\HostingSpaces\\\wwwroot\Folders\NewsImages\m.PNG' is denied.

ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6 and IIS 7, and the configured application pool identity on IIS 7.5) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

Source Error:

Line 71:             //save the image
Line 72: saveFile = Path.Combine(savePath, FileUpload1.FileName); Line 73: FileUpload1.SaveAs(saveFile); Line 74: Line 75: // for product image we also create a thumbnail

or i have below source error :

Source Error:

Line 93:                 string FilePath = "/image/" + FileName;
Line 94:                 string url = @"image\" + FileName;
Line 95:                 FileUpload1.SaveAs(Server.MapPath("~") + FilePath);
Line 96:                 txtActivities.Text += string.Format("<img src='{0}' alt='{1}' />", url, FileUpload1.FileName);
Line 97: 

Source File: d:\hostingspaces\\\wwwroot\PictureUpload.ascx.cs    Line: 73

Stack Trace:

[UnauthorizedAccessException: Access to the path 'D:\HostingSpaces\\\wwwroot\Folders\NewsImages\m.PNG' is denied.]
   System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +9726046
   System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath) +1142
   System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) +78
   System.IO.FileStream..ctor(String path, FileMode mode) +71
   System.Web.HttpPostedFile.SaveAs(String filename) +99
   System.Web.UI.WebControls.FileUpload.SaveAs(String filename) +23
   PictureUpload.btnUpload_Click(Object sender, EventArgs e) in d:\hostingspaces\\\wwwroot\PictureUpload.ascx.cs:73
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563

 savePath = Path.Combine(Request.PhysicalApplicationPath,"Folders/"+ ImagesFolder);

            //save the image
            saveFile = Path.Combine(savePath, FileUpload1.FileName);

            // for product image we also create a thumbnail
            if (_uploadImageType == ImaegType.School)
                string newPath = Path.Combine(savePath, "thumb_" + FileUpload1.FileName);
                ImageHandling.GenerateThumbnail(saveFile, newPath);
            //Notify the user that the file was uploaded successfully.
            Status.Text = "File uploaded with Successfully";
            //let the parent know that the file was uploaded
            OnFileUploaded(new FileUploadEventArgs(FileUpload1.FileName));

and another code for upload image is:

 protected void btnUpload_Click(object sender, EventArgs e) { if (FileUpload1.HasFile) { if (FileUpload1.HasFile) { string FileName = System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName); string FilePath = "/image/" + FileName; string url = @"image\" + FileName; FileUpload1.SaveAs(Server.MapPath("~") + FilePath); txtActivities.Text += string.Format("<img src='{0}' alt='{1}' />", url, FileUpload1.FileName); } } }

Server Error in '/' Application.

Access to the path 'D:\HostingSpaces\\\wwwroot\Folders\NewsImages\m.PNG' is denied.



please help me

thanks alot

You need to give write permission to that folder..... Log into your control panel and give permission


 give write permission for ur folder. 

for giving permission manually