Last post Apr 21, 2014 09:46 PM by Angie xu - MSFT
Apr 14, 2014 06:37 AM|seamus1982|LINK
I have a website that runs on the iis when I use the browser on the localhost. So I enter
Http://localhost/ and the site comes up fine. But when I use the url for the site I get an error
The given key was not present in the dictionary.
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.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
[KeyNotFoundException: The given key was not present in the dictionary.]
System.Collections.Generic.Dictionary`2.get_Item(TKey key) +3814773
PanelGroup_home.Page_Load(Object sender, EventArgs e) +307
System.Web.UI.Control.OnLoad(EventArgs e) +92
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772
Any help would be really appreciated because I am starting to go mad.
Apr 15, 2014 05:41 AM|mike4u|LINK
try to add in web.config file
Apr 21, 2014 09:46 PM|Angie xu - MSFT|LINK
I enter Http://localhost/ and the site comes up fine. But when I use the url for the site I get an error
Does our community member's solution help you fix it?
On pages that have rewritten url, normally not all managed modules are executed (no Authentication etc.). If the dictionary that is accessed would be filled from such a module (like HttpContext.Current.User, which is set in that way too and would be null
without that setting). So it's recommended to add the code above to your web.config configuration section.
Moreover, you could also look into the log file in IIS, check whether it can give some hints why this happens.