Microsoft IIS
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsSystem AdministrationMicrosoft IIS

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old June 30th, 2005, 02:44 AM
pawpaw pawpaw is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 8 pawpaw User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 1 m 32 sec
Reputation Power: 0
Exclamation User Authentication

Good day,

I made a web application (asp.net) that will allow the user to export data from sql server to MS Word, luckily I am able to run the web app on my machine. Unfortunately, when i tried it on a client machine an authorization box pops-up on my screen asking me to input a username and password that will allow me to access the server. I placed the default username and password which is IUSR{computername}. I get an access denied error.

Hope someone could help me on this.

Thanks/Regards,
Paw

Reply With Quote
  #2  
Old June 30th, 2005, 02:51 AM
nofriends's Avatar
nofriends nofriends is offline
Senior Water Wizard
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Aug 2004
Location: Cape Town, RSA
Posts: 10,186 nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 2 Days 7 h 36 m 24 sec
Reputation Power: 699
Please don't double post your questions
So you don't get access to the sql server from the client machine?
did you change your connection string to access the server on a different machine?
__________________
Look! Its a ShemZilla



Reply With Quote
  #3  
Old June 30th, 2005, 03:26 AM
pawpaw pawpaw is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 8 pawpaw User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 1 m 32 sec
Reputation Power: 0
Quote:
Originally Posted by nofriends
Please don't double post your questions
So you don't get access to the sql server from the client machine?
did you change your connection string to access the server on a different machine?


Hi nofriends, sorry about that. nope I didn't changed my connection string to access the server on a different machine. My queries are all working fine and I am able to generate a result set except that I am not able to export these (result set) to an excel file or word file on a client machine.

Thanks,
Paw

Reply With Quote
  #4  
Old June 30th, 2005, 03:30 AM
nofriends's Avatar
nofriends nofriends is offline
Senior Water Wizard
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Aug 2004
Location: Cape Town, RSA
Posts: 10,186 nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 2 Days 7 h 36 m 24 sec
Reputation Power: 699
Make sure that the IUSR_<%MachineName%> has the correct rights in the folder that you are trying to export the excel and word file, that should do the trick

Reply With Quote
  #5  
Old June 30th, 2005, 03:40 AM
pawpaw pawpaw is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 8 pawpaw User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 1 m 32 sec
Reputation Power: 0
Quote:
Originally Posted by nofriends
Make sure that the IUSR_<%MachineName%> has the correct rights in the folder that you are trying to export the excel and word file, that should do the trick




Thanks nofriends...but my problem is not my linkbutton to export the files but the calling of the excel application in client side or locally. When I click my linkbutton to export in my machine it works properly but if i already click the button(Export linkButton) in other machine there's a authentication message box asking for a username and password of the client to connect on my machine.

Thank you very much nofriends!
paw

Reply With Quote
  #6  
Old June 30th, 2005, 03:46 AM
nofriends's Avatar
nofriends nofriends is offline
Senior Water Wizard
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Aug 2004
Location: Cape Town, RSA
Posts: 10,186 nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 2 Days 7 h 36 m 24 sec
Reputation Power: 699
could you paste the relevent code?

Reply With Quote
  #7  
Old June 30th, 2005, 03:51 AM
nofriends's Avatar
nofriends nofriends is offline
Senior Water Wizard
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Aug 2004
Location: Cape Town, RSA
Posts: 10,186 nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 2 Days 7 h 36 m 24 sec
Reputation Power: 699
its sounds like your are trying to create the file on your machine, instead of the client machine?

Reply With Quote
  #8  
Old June 30th, 2005, 03:53 AM
pawpaw pawpaw is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 8 pawpaw User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 1 m 32 sec
Reputation Power: 0
Quote:
Originally Posted by nofriends
could you paste the relevent code?


sure!This is the code of my linkbutton to export the content of my datagrid to excel:
Code:
    Dim priorSum As Integer = 0
        Dim newSum As Integer = 0
        Dim xlProcID As Integer = 0
        Dim dt As New DataTable
        'Dim tw As New System.IO.StringWriter
        'Dim hw As New System.Web.UI.Html32TextWriter(tw)
        dt = Session("Results")

        For Each proc1 As Process In Process.GetProcessesByName("excel")
            priorSum += proc1.Id
        Next proc1

        Dim excelApp As New Excel.Application
        Dim excelBook As Excel.Workbook = excelApp.Workbooks.Add
        'excelapp.ActiveWindow
        Dim excelWorksheet As Excel.Worksheet = CType(excelBook.Worksheets(1), Excel.Worksheet)
        Dim excelCharts As Excel.ChartObjects = _
         CType(excelWorksheet.ChartObjects(), Excel.ChartObjects)
        excelApp.Visible = True
        With excelWorksheet
            ' Set the column headers and desired formatting for the spreadsheet.
            .Columns().ColumnWidth = 21
            .Range("A1").Value = "File Reference No."
            .Range("A1").Font.Bold = True
            .Range("A1").Font.Size = 8
            .Range("A1").Font.Color = RGB(255, 255, 255)
            .Range("A1").Interior.Color = RGB(0, 0, 0)
            .Range("B1").Value = "Name"
            .Range("B1").Font.Bold = True
            .Range("B1").Font.Size = 8
            .Range("B1").Font.Color = RGB(255, 255, 255)
            .Range("B1").Interior.Color = RGB(0, 0, 0)
            .Range("C1").Value = "Social Security Number"
            .Range("C1").Font.Bold = True
            .Range("C1").Font.Size = 8
            .Range("C1").Font.Color = RGB(255, 255, 255)
            .Range("C1").Interior.Color = RGB(0, 0, 0)
            .Range("D1").Value = "First Position Desired"
            .Range("D1").Font.Bold = True
            .Range("D1").Font.Size = 8
            .Range("D1").Font.Color = RGB(255, 255, 255)
            .Range("D1").Interior.Color = RGB(0, 0, 0)
            .Range("E1").Value = "Second Position Shift"
            .Range("E1").Font.Bold = True
            .Range("E1").Font.Size = 8
            .Range("E1").Font.Color = RGB(255, 255, 255)
            .Range("E1").Interior.Color = RGB(0, 0, 0)
            .Range("F1").Value = "Date"
            .Range("F1").Font.Bold = True
            .Range("F1").Font.Size = 8
            .Range("F1").Font.Color = RGB(255, 255, 255)
            .Range("F1").Interior.Color = RGB(0, 0, 0)
            excelWorksheet.PageSetup.Orientation = Excel.XlPageOrientation.xlLandscape
            ' Start the counter on the second row, following the column headers
            Dim i As Integer = 2
            ' Loop through the Rows collection of the DataSet and write the data
            ' in each row to the cells in Excel. 
            Dim dr As DataRow
            Dim intTotal, iFooter As Integer

            If Not dt.DataSet.Tables(0).Rows.Count > 0 Then
                Exit Sub
            End If

            For Each dr In dt.DataSet.Tables(0).Rows

                intTotal = 0
                'MsgBox(dr(0))

                .Range("A" & i.ToString).Value = dr(0)
                .Range("A" & i.ToString).Font.Size = 8
                .Range("B" & i.ToString).Value = dr(1)
                .Range("B" & i.ToString).Font.Size = 8
                .Range("C" & i.ToString).Value = dr(2)
                .Range("C" & i.ToString).Font.Size = 8
                .Range("D" & i.ToString).Value = dr(3)
                .Range("D" & i.ToString).Font.Size = 8
                .Range("E" & i.ToString).Value = dr(4)
                .Range("E" & i.ToString).Font.Size = 8
                .Range("F" & i.ToString).Value = dr(5)
                .Range("F" & i.ToString).Font.Size = 8
                i += 1
            Next
            'TODO: Create a configurable path.
            '
            Dim path As String = "c:\Export\Excel"
            If File.Exists(path) Then
                File.Delete(path)
            End If
            Dim dateGenerated As Date
            path += Replace(dateGenerated.Now.ToShortDateString, "/", "") & Replace(dateGenerated.Now.ToShortTimeString.Replac  e(" ", ""), ":", "")

            path += ".xls"
            b = path
            Session("AttachFile") = b
            excelWorksheet.SaveAs(path)

            For Each proc2 As Process In Process.GetProcessesByName("excel")
                newSum += proc2.Id
            Next proc2
            xlProcID = newSum - priorSum

            'Get the process ID of the Excel application
            Dim proc As Process = Process.GetProcessById(xlProcID)
            'If excelApp.Visible = False Then
            proc.WaitForExit(120000)
            proc.Kill()
            'End If




nofriends this is the error i encountered when i already use my linkbutton in other machine:

Access is denied.
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 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) 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 write 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 74: Next proc1
Line 75:
Line 76: Dim excelApp As New Excel.Application
Line 77: Dim excelBook As Excel.Workbook = excelApp.Workbooks.Add
Line 78: 'excelapp.ActiveWindow



Source File: c:\inetpub\wwwroot\Personnel\Menu.ascx.vb Line: 76

Stack Trace:


[UnauthorizedAccessException: Access is denied.]
Personnel.Menu.lnkbtnExport_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\Personnel\Menu.ascx.vb:76
System.Web.UI.WebControls.LinkButton.OnClick(Event Args e)
System.Web.UI.WebControls.LinkButton.System.Web.UI .IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
System.Web.UI.Page.ProcessRequestMain()


Thank you so much nofriends.

Last edited by Shadow Wizard : June 30th, 2005 at 04:08 AM. Reason: added code tags - please do it yourself with [code] and [/code] tags next.

Reply With Quote
  #9  
Old June 30th, 2005, 04:00 AM
nofriends's Avatar
nofriends nofriends is offline
Senior Water Wizard
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Aug 2004
Location: Cape Town, RSA
Posts: 10,186 nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 2 Days 7 h 36 m 24 sec
Reputation Power: 699
This is ASP.Net, I am a total n00b at this
I will get someone to have a look at this, just hold on

Reply With Quote
  #10  
Old June 30th, 2005, 04:03 AM
pawpaw pawpaw is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 8 pawpaw User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 1 m 32 sec
Reputation Power: 0
Quote:
Originally Posted by nofriends
its sounds like your are trying to create the file on your machine, instead of the client machine?



Yes it is nofriends! The data is from the server using asp.net application to retrieve it, the user then has an option if he wants to save the data to an excel file right unto his local machine (client). Whenever I try it on my client test machine I was always asked to input a username and password under the server machine's domain. The question is, how will I enable a client user to call it's local excel application?

Thanks,
paw

Reply With Quote
  #11  
Old June 30th, 2005, 04:05 AM
pawpaw pawpaw is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 8 pawpaw User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 1 m 32 sec
Reputation Power: 0
Quote:
Originally Posted by nofriends
This is ASP.Net, I am a total n00b at this
I will get someone to have a look at this, just hold on



OK!Thank you nofriends!

Reply With Quote
  #12  
Old June 30th, 2005, 04:12 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 46th Plane (27500 - 27999 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,721 Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)  Folding Points: 377411 Folding Title: Super Ultimate Folder - Level 1Folding Points: 377411 Folding Title: Super Ultimate Folder - Level 1Folding Points: 377411 Folding Title: Super Ultimate Folder - Level 1Folding Points: 377411 Folding Title: Super Ultimate Folder - Level 1Folding Points: 377411 Folding Title: Super Ultimate Folder - Level 1Folding Points: 377411 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 5 h 20 m 20 sec
Reputation Power: 1914
please wrap your code with code tags in the future. ([ code] and [ /code] tags)
anyway, make sure that Anonymous Access is enabled on the server.
(Internet Services Manager --> right click your website --> Properties --> Directory Security --> Edit --> first checkbox)