473,385 Members | 1,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Authentication to view PDF

I have the below code which authenticates a user to view a PDF. Username and
Password are submitted through the querystring and then checked server-side.
Upon correct username password, the ASP page will stream the PDF, otherwise,
a sorry message will appear.

<%
Response.ContentType = "application/x-pdf"

Dim strURL

If Request.QueryString("username")="todd" And
Request.QueryString("password")="smith" Then
Response.Redirect "http://intranews/norights.pdf"
Else
Response.Redirect "http://intranews/newpaper1023.pdf"
End If
%>

How would this be coded in ASP.NET (with C# or VB.NET behind code)?

Thank you in advance.

-Jess
Nov 18 '05 #1
1 1302
You might want to pick up a book on ASP.NET or visit one of the many web
sites that cover ASP.NET for help you re-write your own code.
"jesse james 2020" <je************@discussions.microsoft.com> wrote in
message news:29**********************************@microsof t.com...
I have the below code which authenticates a user to view a PDF. Username and Password are submitted through the querystring and then checked server-side. Upon correct username password, the ASP page will stream the PDF, otherwise, a sorry message will appear.

<%
Response.ContentType = "application/x-pdf"

Dim strURL

If Request.QueryString("username")="todd" And
Request.QueryString("password")="smith" Then
Response.Redirect "http://intranews/norights.pdf"
Else
Response.Redirect "http://intranews/newpaper1023.pdf"
End If
%>

How would this be coded in ASP.NET (with C# or VB.NET behind code)?

Thank you in advance.

-Jess

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jay | last post by:
I have authentication set for my site but I need one page to be an exception case. Namely my forgot password page. How do I tell the webconfig file to authenciate all pages except one page? ...
3
by: Kris van der Mast | last post by:
Hi, I've created a little site for my sports club. In the root folder there are pages that are viewable by every anonymous user but at a certain subfolder my administration pages should be...
0
by: francois | last post by:
hello, I am using forms authentication and I would like that my authentication cookie expires after let say 1 minutes (just for the exemple). When I log in in my longon page, the user has to...
1
by: David Krussow | last post by:
I have implemented ASP.NET Forms authentication in a test app. The app has a number of forms - only one of which requires authentication in order to be viewed (the "secured form"). Everything works...
4
by: Andrew | last post by:
Hey all, I would like to preface my question by stating I am still learning ASP.net and while I am confident in the basics and foundation, the more advanced stuff is still a challenge. Ok....
4
by: nicholas | last post by:
Hi, Got an asp.net application and I use the "forms" authentication mode defined in the web.config file. Everything works fine. But now I would like to add a second, different login page for...
2
by: Jerry O | last post by:
Hi, I appear to have a problem where the user is not kicked back to the forms authentictation url when they post a webform, via a get, that results in a long url due to viewstate. Instead they...
2
by: Smithers | last post by:
Will Forms Authentication work for me, or do I have to "roll my own" security model on this one. What I have is an aspx page that will display information based on a querystring value. Some of...
8
by: Nils Magnus Englund | last post by:
Hello, I am having trouble using Integrated Windows Authentication between our intranet server and our database server, both of which are on our local domain. Windows authentication works for...
9
by: dana lees | last post by:
Hello, I am developing a C# asp.net application. I am using the authentication and authorization mechanism, which its timeout is set to 60 minutes. My application consists of 2 frames - a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.