I don’t know if this question belongs to this forum.
I'm developing a website with vb.net web application using visual studio 2015 where a client is able to download a pdf file and I have considered 2 approaches as follows.
Dim sqlcom AsNew SqlCommand("select bookcontent,bookname from books where bookn=" & Page.RouteData.Values("bookn").ToString & "", conn)
Dim da AsNew SqlDataAdapter(sqlcom)
Dim ds AsNew DataTable
Dim filename AsString = ds.Rows(0)("bookcontent").ToString
Dim fff AsString = ds.Rows(0)("bookname").ToString
Dim fileInfo As FileInfo = New FileInfo(filename)
If fileInfo.Exists Then
Response.Buffer = True
Response.Charset = ""
Response.ContentType = "Application/pdf"
Response.ContentType = "application/ms-word"
Response.AddHeader("Content-Disposition", "inline; filename=""" & ds.Rows(0)("bookname").ToString & ".pdf" & """")
I'm having trouble with the first approach above because when downloaded start the website
Hang on until pdf file fully downloaded to client PC ,this is bad since website will be access
By thousand of users every day,so I want to make the download process asynchronous.
I use the .NET Framework WebClient class in the second approach:
Dim Client AsNew WebClient
Dim weburl As String= ....here is some procedure toget url
Client.DownloadFileAsync(New Uri(weburl), @"c:\myfile.pdf")
But the problem here is that a path must be set and I want clients to get the file in the default download folder according to the Internet browser they use and the download process not appear through browser user can't see downloading file progress .
I will very much appreciate any comment that points me in the direction to solve this issue.
Thanks a lot.
The second approach isn't going to work, your code is running on the server so when you download to c:\myfile.pdf it will download from the url to that path on the server and not the client's machine. It might appear to work when running the site locally, but that is only because the client and server are the same machine, when you host it remotely it'll stop working.
You'll need to stick with the first method but I wouldn't worry about it, just let IIS deal with the threading for you.
If I create an account on my Web App, using my email address firstname.lastname@example.org, and then later I'm offered the opportunity to login to my Web App using Google SignIn; because I just wrote the code to add this feature, and elected to use it.
Should I use googleUser's email address (email@example.com) as the account name, because I want to create an account to represent the user. But id the email is in use already, just update the login, and use the googleUser token to authenticate again, to AuthGuard.
I can login using either method to the same account.
I can't really think of any, which is why I'm asking. Am I over looking something, perhaps someone's experience can say ... "No don't do that because ...".
Use googleUsers first and last name, and sort of create a new account name from it that is unique.
I can't think of any
EBay did this to me, and I ended up with 2 EBay accounts; didn't realize it for months, and really wish I just had the one.
Sounds like a dumb question, but wanted to ask before going into production mode.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
In the company intranet where I work there is a web-based documentation system that you can access through a regular web browser (Chrome, Firefox, Edge, etc). I need to write an application (in C#) that interfaces to this documentation system and I'm currently working on making sure that I can programmatically supply the user name and password correctly. When accessing the documentation system through a web browser, I always have to supply the user name and password once after re-boot and then I never have to type it again until next re-boot. I've come to the conclusion that the user name and password are being stored somewhere in the computer, but they are not stored in the browsers themselves and if I go to Control Panel -> User Accounts -> Credential Manager I see mostly Microsoft related passwords (Microsoft Outlook, Microsoft Office, XboxLive, SSO_POP_Device, virtualapp/didlogical, tfs, etc). Does anybody know where the user name and password could be stored and how I can remove them (without rebooting my computer) in order to be able to verify that my code supplies the user name and password correctly? I already asked the IT-manager (who's also in charge of the documentation system) and he didn't know.
Does it display a form within the site to enter the credentials, or does it pop up the "Windows authentication" dialog box?
If it's a form within the site, then the site is probably setting an authentication cookie. This won't contain the credentials (unless the site was written by someone who didn't know what they were doing!); instead, it will contain a signed and encrypted token which the server can use to identify the user. If you clear the cookies for the site, then you should be prompted to log in again.
If it's popping up the "Windows authentication" dialog box, then the browser will cache the credentials securely until it is closed. When you close and reopen the browser, you should be prompted to log in again.
For Internet Explorer, you can clear the Windows authentication cache without closing the browser by executing the (non-standard; deprecated) command:
Yes, it's Windows Authentication. Chrome and Interner Explorer are still running in the Ctrl+Alt+Delete task manager, even though all windows are closed so I guess that's why they remember the credentials. Thank you for solving this.
I'm working on a filter for a Custom Post Type . I need it to filter the list depending on the user's role. The way this should work is the following...
- Users in roles "formusers1" and "formusers2" can post. Users can only see their own posts.
- Users in role "formchecker1" can see all posts assigned role "formusers1' and can approve each post.
- Users in role "formchecker2" can see all posts assigned role "formusers2' and can approve each post.
- Users in roles "formsupervisor" and "administrator" can see everyone's posts.
So far I can filter by roles "formusers1" and "formusers2" using:
However, when try to filter the list for role "formchecker1" I see posts from all roles. What am I doing wrong? Here's the rest of the code. Thanks for checking out!
I'll be creating an Asp.Net Web API for a construction management app I'm working on. I'v created API's before, and I usually create one controller for each functional area. So, for Projects I have a ProjectController, for Jobs there's a JobController, Employees has an EmployeeController. In eah controller I place methods that access the DAL for everything related to that functional area.
Is this the right approach? I'm open to suggestion.
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
We really can't tell you - it's far, far too big a question for a little text box!
And next databases ... SQL Server, MySql are the most common, but there are others.
Then, hosting: where are you going to put it? You need a domain or people can't get to it, and that normally means a hosting service - so then you have to find out what they provide, and estimate how much resources you will need - and how much you are willing to pay for them!
Finally, there is the type of website you want to develop: a shop front, a blog store, a chat room, a game, an advertising hoarding, ... there are as many of them as there are websites, pretty much.
And all of this comes with a learning curve - while you can create a basic website with just HTML and a free hosting service it won't be at all interactive and so unlikely to attract any visitors.
To add to the fun, we have no idea of your skills, interests or abilities, and that really restricts what you can get up and running in a short time, and severely restricts any advice we could give you.
What I'd suggest is that you look at your current skill set and find a book (or better a course) which builds on on those skills and expands them in the direction you want to go. Addison Wesley, Wrox, and Microsoft Press all do good books on a huge range of web related projects so go have a look at their ranges and see what fits you abilities.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
Start HERE to learn HTML[^] - that's the most basic language of the web. Make a web page
Afterwards, move on to CSS (CSS3 these days) - teaches you how to format decorate the page
Finally, I prefer PHP. PHP will allow you to build pages uniquely for each user, access databases, move files. Make a real website!
The first three have interactive "try it" areas for you to see the code, modify it, and then see what happens.