Problem with Excel template

  • Thread starter Thread starter Karen A Hodge
  • Start date Start date
K

Karen A Hodge

I have a website that has an Excel template. The template contains 3
QueryTables. The template is located on the web server. I would like to
refresh the data prior to the user opening the template from the website.
This is the code:

wb = excelApp.Workbooks.Add(FilePath)
wb.RefreshAll()
wb.Save()
excelApp.Quit()
.... User opens template

The problem is that the user is prompted for a UserName and Password. It
must be a permission issue because when I run from development in debug, I
do not get a prompt.

How do I get around this? I have given everything but full control on the
folder to the ASPNET account and anything else that look like ASP--I still
get the message.

Thanks in advance.
Karen
 
Hi Karen:

Does the web service require authentication? If you browse to the web
service with Internet Explorer does it prompt you? If the web service
is written in .NET, check in the web.config file to see how the
authentication and authorization sections are set.
 
I use Forms Authentication. Here is a sample

<!-- AUTHENTICATION
This section sets the authentication policies of the application.
Possible modes are "Windows",
"Forms", "Passport" and "None"
-->
<authentication mode="Forms">
<forms name=".ASPXAUTH" loginUrl="Default.aspx" protection="All" path="/"
timeout="30">
<credentials passwordFormat="Clear">
<user name="LeadershipApplicant" password="d1913st"/>
</credentials>
</forms>
</authentication>


<!-- AUTHORIZATION
This section sets the authorization policies of the application.
You can allow or deny access
to application resources by user or role. Wildcards: "*" mean
everyone, "?" means anonymous
(unauthenticated) users.
-->
<authorization>
<deny users="?"/> <!-- deny unauthenticated Users -->

<!-- <allow users="[comma separated list of users]"
roles="[comma separated list of roles]"/>
<deny users="[comma separated list of users]"
roles="[comma separated list of roles]"/>
-->
</authorization>

<identity impersonate="true"/>
 
Hi Karen:

It looks as if the webservice requires authentication. In this case
changing security settings on the server will not help (unless you
change the web.config authentication mode).

You'll have to find a way to pass those credentials along with the web
service request from Excel. Do you know if you are using the SOAP
toolkit, or did you write an Office add-in with Visual Studio .NET?

--
Scott
http://www.OdeToCode.com

I use Forms Authentication. Here is a sample

<!-- AUTHENTICATION
This section sets the authentication policies of the application.
Possible modes are "Windows",
"Forms", "Passport" and "None"
-->
<authentication mode="Forms">
<forms name=".ASPXAUTH" loginUrl="Default.aspx" protection="All" path="/"
timeout="30">
<credentials passwordFormat="Clear">
<user name="LeadershipApplicant" password="d1913st"/>
</credentials>
</forms>
</authentication>


<!-- AUTHORIZATION
This section sets the authorization policies of the application.
You can allow or deny access
to application resources by user or role. Wildcards: "*" mean
everyone, "?" means anonymous
(unauthenticated) users.
-->
<authorization>
<deny users="?"/> <!-- deny unauthenticated Users -->

<!-- <allow users="[comma separated list of users]"
roles="[comma separated list of roles]"/>
<deny users="[comma separated list of users]"
roles="[comma separated list of roles]"/>
-->
</authorization>

<identity impersonate="true"/>
 
Back
Top