A redirected web.confg problem - DOTNET

This is a discussion on A redirected web.confg problem - DOTNET ; Hi All, I am using a web method to retrieve the connection string stored in the web service virtual directory "/Dev". When I browse the asmx file from VS 2005, everything works perfectly. However when I browse it from IIS ...

+ Reply to Thread
Results 1 to 2 of 2

A redirected web.confg problem

  1. Default A redirected web.confg problem

    Hi All,

    I am using a web method to retrieve the connection string stored in the web
    service virtual directory "/Dev". When I browse the asmx file from VS 2005,
    everything works perfectly. However when I browse it from IIS or directly
    from IE (by entering the address into IE), I get the following error:

    System.Configuration.ConfigurationErrorsException: Failed to decrypt using
    provider 'RsaProtectedConfigurationProvider'. Error message from the
    provider: The RSA key container could not be opened.
    (C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\web.config line
    15) ---> System.Configuration.ConfigurationErrorsException: The RSA key
    container could not be opened.
    at
    System.Configuration.RsaProtectedConfigurationProvider.ThrowBetterException(Boolean
    keyMustExist)
    at
    System.Configuration.RsaProtectedConfigurationProvider.GetCryptoServiceProvider(Boolean
    exportable, Boolean keyMustExist)
    at System.Configuration.RsaProtectedConfigurationProvider.Decrypt(XmlNode
    encryptedNode)
    at
    System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.DecryptSection(String
    encryptedXml, ProtectedConfigurationProvider protectionProvider,
    ProtectedConfigurationSection protectedConfigSection)
    at
    System.Configuration.Internal.DelegatingConfigHost.DecryptSection(String
    encryptedXml, ProtectedConfigurationProvider protectionProvider,
    ProtectedConfigurationSection protectedConfigSection)
    at
    System.Configuration.Internal.DelegatingConfigHost.DecryptSection(String
    encryptedXml, ProtectedConfigurationProvider protectionProvider,
    ProtectedConfigurationSection protectedConfigSection)
    at
    System.Configuration.BaseConfigurationRecord.CallHostDecryptSection(String
    encryptedXml, ProtectedConfigurationProvider protectionProvider,
    ProtectedConfigurationSection protectedConfig)
    at
    System.Configuration.BaseConfigurationRecord.DecryptConfigSection(ConfigXmlReader
    reader, ProtectedConfigurationProvider protectionProvider)
    --- End of inner exception stack trace ---
    at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[]
    keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord,
    SectionRecord sectionRecord, Object parentResult)
    at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord
    factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean
    getLkg, Boolean getRuntimeObject, Object& result, Object&
    resultRuntimeObject)
    at
    System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String
    configKey, Boolean getLkg, Boolean checkPermission, Boolean
    getRuntimeObject, Boolean requestIsHere, Object& result, Object&
    resultRuntimeObject)
    at
    System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String
    configKey, Boolean getLkg, Boolean checkPermission, Boolean
    getRuntimeObject, Boolean requestIsHere, Object& result, Object&
    resultRuntimeObject)
    at
    System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String
    configKey, Boolean getLkg, Boolean checkPermission, Boolean
    getRuntimeObject, Boolean requestIsHere, Object& result, Object&
    resultRuntimeObject)
    at
    System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String
    configKey, Boolean getLkg, Boolean checkPermission, Boolean
    getRuntimeObject, Boolean requestIsHere, Object& result, Object&
    resultRuntimeObject)
    at System.Configuration.BaseConfigurationRecord.GetSection(String
    configKey, Boolean getLkg, Boolean checkPermission)
    at System.Configuration.Configuration.GetSection(String sectionName)
    at System.Configuration.Configuration.get_ConnectionStrings()
    at XmlDataTranslation.GetPath()

    Is there a reason why my calls to my web.config is being redirected to
    C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\web.config?

    I used the following code:

    [WebMethod]
    public string GetConnectionString()
    {
    return
    WebConfigurationManager.OpenWebConfiguration.(HttpContext.Current.Request.ApplicationPath).ConnectionStrings.ConnectionStrings.Count.ToString();
    }




  2. Default Re: A redirected web.confg problem

    "xs" <blizzardstorm8899@yahoo.com.sg> wrote in message
    news:eL7B0NB1HHA.748@TK2MSFTNGP04.phx.gbl...
    > Hi All,
    >
    > I am using a web method to retrieve the connection string stored in the
    > web service virtual directory "/Dev". When I browse the asmx file from VS
    > 2005, everything works perfectly. However when I browse it from IIS or
    > directly from IE (by entering the address into IE), I get the following
    > error:
    >
    > System.Configuration.ConfigurationErrorsException: Failed to decrypt using
    > provider 'RsaProtectedConfigurationProvider'. Error message from the
    > provider: The RSA key container could not be opened.
    > (C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\web.config line
    > 15) ---> System.Configuration.ConfigurationErrorsException: The RSA key
    > container could not be opened.

    ....

    >
    > Is there a reason why my calls to my web.config is being redirected to
    > C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\web.config?


    It's not being redirected. Recall that web.config files (and any
    configuration file using the .NET configuration API) is hierarchical. I
    suggest you take a look at like 15 of that file, as the exception message
    suggests.

    > I used the following code:
    >
    > [WebMethod]
    > public string GetConnectionString()
    > {
    > return
    > WebConfigurationManager.OpenWebConfiguration.(HttpContext.Current.Request.ApplicationPath).ConnectionStrings.ConnectionStrings.Count.ToString();
    > }


    BTW, I expect you'll find that your credentials vary based on how you browse
    to your service. This may explain the difference in access to the key
    container.
    --
    John Saunders [MVP]



+ Reply to Thread

Similar Threads

  1. how check new URL of redirected page
    By Application Development in forum Perl
    Replies: 8
    Last Post: 12-06-2007, 10:41 PM
  2. email being redirected
    By Application Development in forum Microsoft Exchange
    Replies: 7
    Last Post: 06-12-2007, 10:23 AM
  3. ftp gets redirected.
    By Application Development in forum Inetserver
    Replies: 4
    Last Post: 11-01-2006, 10:21 PM
  4. LWP::UserAgent and redirected page responses
    By Application Development in forum Perl
    Replies: 7
    Last Post: 10-22-2005, 07:34 PM
  5. URL being redirected
    By Application Development in forum Inetserver
    Replies: 3
    Last Post: 09-06-2004, 02:25 PM