Showing posts with label file. Show all posts
Showing posts with label file. Show all posts

Monday, March 26, 2012

newbie aspx.vb file question

I am brand new at building asp.net web sites. I am going through a site now that has some code behind links to aspx.vb files. I realize these files are compiled into dlls and used that way. But I am trying to find the aspx.vb files so I can review the actual code. Where are these files normally kept?

Thank you, in advance.

Jim

Hey Jim,

The *.vb files should be kept in the same directory as their corresponding *.aspx file. If the *.vb files don't exist in the same directory as the *.aspx files it is because a) the web site was pre-compiled and the code behind files are now packaged in a DLL as you mentioned or b) the code behind is inline in the *.aspx files (the code behind files do not have to be separated out into a separate file, they can be in the *.aspx file in a <script> block.)

Quick reference:

*.aspx files: Presentation Layer (HTML + ASP.NET controls)

*.vb or *.cs files : Codebehind files that go along with matchting *.aspx files (these are optional as code can be included in <script> blocks in the *.aspx pages.)

Hope that helps.

-Aaron

Saturday, March 24, 2012

newbie file security question

This is probably simple, but I don't know the answer:
I have a very large directory of files (including html, .doc, .pdf's,
folders, etc, etc).
I want to have these available for people to browse, but I want them only to
be able to browse them if they are logged in, how do I do this? Sorry, I'm
very new to ASP.NET.This can be done in IIS alone, enable directory browsing on the site
and require a password on the site (uncheck allow anonymous access).

Thursday, March 22, 2012

Newbie IMAGE SRC question

Hello all!
I basicly know how to pull a image down with using Image source in HTML. By
telling image src what file name to open. But if I have the file path stored
in a SQL database. such as c:/mypictures/myimagefile.gif, how would I call
that back up, to show that file with out typing the path in my code. Can I
just refrence the sql server, and read that file path? What would be the
correct way of writing that in my code. Or am I totally off base, and do
this an entirely diffrent way.
TIA!!!
RudyYou'll have to write code to pull the image form your database then write
it to the Response.OutputStream. I have a sample app that should get you
started:
http://staff.develop.com/ballen/blo.../>
aff48bf2481
-Brock
DevelopMentor
http://staff.develop.com/ballen

> Hello all!
> I basicly know how to pull a image down with using Image source in
> HTML. By telling image src what file name to open. But if I have the
> file path stored in a SQL database. such as
> c:/mypictures/myimagefile.gif, how would I call that back up, to show
> that file with out typing the path in my code. Can I just refrence
> the sql server, and read that file path? What would be the correct
> way of writing that in my code. Or am I totally off base, and do this
> an entirely diffrent way.
> TIA!!!
> Rudy
>
This article explains in detail how to pull files from a database and
display them dynamically to the user:
http://steveorr.net/articles/EasyUploads.aspx
This one explains how to generate images dynamically and display them to the
user:
http://steveorr.net/articles/ImproveYourImages.aspx
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Rudy" <Rudy@.discussions.microsoft.com> wrote in message
news:B76F371F-B5A7-42F4-BCAD-56FF560D8A99@.microsoft.com...
> Hello all!
> I basicly know how to pull a image down with using Image source in HTML.
> By
> telling image src what file name to open. But if I have the file path
> stored
> in a SQL database. such as c:/mypictures/myimagefile.gif, how would I call
> that back up, to show that file with out typing the path in my code. Can
> I
> just refrence the sql server, and read that file path? What would be the
> correct way of writing that in my code. Or am I totally off base, and do
> this an entirely diffrent way.
> TIA!!!
> Rudy
Hi Brock and Steve,
Thank you for the advise. I'll try it out tonite. I just want to make sure
I'm clear, I am not storing the image in the SQL db, just the filepath. Wil
l
this still work?
Thanks for your help!!!!
"Steve C. Orr [MVP, MCSD]" wrote:

> This article explains in detail how to pull files from a database and
> display them dynamically to the user:
> http://steveorr.net/articles/EasyUploads.aspx
> This one explains how to generate images dynamically and display them to t
he
> user:
> http://steveorr.net/articles/ImproveYourImages.aspx
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://SteveOrr.net
>
> "Rudy" <Rudy@.discussions.microsoft.com> wrote in message
> news:B76F371F-B5A7-42F4-BCAD-56FF560D8A99@.microsoft.com...
>
>
It should be roughly similar.
The main difference would be that (instead of grabbing the bytes from a
database field) you'll probably be using Response.WriteFile.
Here's more info on Response.WriteFile
http://msdn.microsoft.com/library/d...tefiletopic.asp
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Rudy" <Rudy@.discussions.microsoft.com> wrote in message
news:B91B851D-4A86-4A35-A6C2-F43ACC83E0A9@.microsoft.com...
> Hi Brock and Steve,
> Thank you for the advise. I'll try it out tonite. I just want to make
> sure
> I'm clear, I am not storing the image in the SQL db, just the filepath.
> Will
> this still work?
> Thanks for your help!!!!
> "Steve C. Orr [MVP, MCSD]" wrote:
>

Newbie IMAGE SRC question

Hello all!

I basicly know how to pull a image down with using Image source in HTML. By
telling image src what file name to open. But if I have the file path stored
in a SQL database. such as c:/mypictures/myimagefile.gif, how would I call
that back up, to show that file with out typing the path in my code. Can I
just refrence the sql server, and read that file path? What would be the
correct way of writing that in my code. Or am I totally off base, and do
this an entirely diffrent way.

TIA!!!

RudyYou'll have to write code to pull the image form your database then write
it to the Response.OutputStream. I have a sample app that should get you
started:

http://staff.develop.com/ballen/blo...f8-9aff48bf2481

-Brock
DevelopMentor
http://staff.develop.com/ballen

> Hello all!
> I basicly know how to pull a image down with using Image source in
> HTML. By telling image src what file name to open. But if I have the
> file path stored in a SQL database. such as
> c:/mypictures/myimagefile.gif, how would I call that back up, to show
> that file with out typing the path in my code. Can I just refrence
> the sql server, and read that file path? What would be the correct
> way of writing that in my code. Or am I totally off base, and do this
> an entirely diffrent way.
> TIA!!!
> Rudy
This article explains in detail how to pull files from a database and
display them dynamically to the user:
http://steveorr.net/articles/EasyUploads.aspx

This one explains how to generate images dynamically and display them to the
user:
http://steveorr.net/articles/ImproveYourImages.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"Rudy" <Rudy@.discussions.microsoft.com> wrote in message
news:B76F371F-B5A7-42F4-BCAD-56FF560D8A99@.microsoft.com...
> Hello all!
> I basicly know how to pull a image down with using Image source in HTML.
> By
> telling image src what file name to open. But if I have the file path
> stored
> in a SQL database. such as c:/mypictures/myimagefile.gif, how would I call
> that back up, to show that file with out typing the path in my code. Can
> I
> just refrence the sql server, and read that file path? What would be the
> correct way of writing that in my code. Or am I totally off base, and do
> this an entirely diffrent way.
> TIA!!!
> Rudy
Hi Brock and Steve,

Thank you for the advise. I'll try it out tonite. I just want to make sure
I'm clear, I am not storing the image in the SQL db, just the filepath. Will
this still work?

Thanks for your help!!!!

"Steve C. Orr [MVP, MCSD]" wrote:

> This article explains in detail how to pull files from a database and
> display them dynamically to the user:
> http://steveorr.net/articles/EasyUploads.aspx
> This one explains how to generate images dynamically and display them to the
> user:
> http://steveorr.net/articles/ImproveYourImages.aspx
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://SteveOrr.net
>
> "Rudy" <Rudy@.discussions.microsoft.com> wrote in message
> news:B76F371F-B5A7-42F4-BCAD-56FF560D8A99@.microsoft.com...
> > Hello all!
> > I basicly know how to pull a image down with using Image source in HTML.
> > By
> > telling image src what file name to open. But if I have the file path
> > stored
> > in a SQL database. such as c:/mypictures/myimagefile.gif, how would I call
> > that back up, to show that file with out typing the path in my code. Can
> > I
> > just refrence the sql server, and read that file path? What would be the
> > correct way of writing that in my code. Or am I totally off base, and do
> > this an entirely diffrent way.
> > TIA!!!
> > Rudy
>
It should be roughly similar.
The main difference would be that (instead of grabbing the bytes from a
database field) you'll probably be using Response.WriteFile.

Here's more info on Response.WriteFile
http://msdn.microsoft.com/library/d...tefiletopic.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"Rudy" <Rudy@.discussions.microsoft.com> wrote in message
news:B91B851D-4A86-4A35-A6C2-F43ACC83E0A9@.microsoft.com...
> Hi Brock and Steve,
> Thank you for the advise. I'll try it out tonite. I just want to make
> sure
> I'm clear, I am not storing the image in the SQL db, just the filepath.
> Will
> this still work?
> Thanks for your help!!!!
> "Steve C. Orr [MVP, MCSD]" wrote:
>> This article explains in detail how to pull files from a database and
>> display them dynamically to the user:
>> http://steveorr.net/articles/EasyUploads.aspx
>>
>> This one explains how to generate images dynamically and display them to
>> the
>> user:
>> http://steveorr.net/articles/ImproveYourImages.aspx
>>
>> --
>> I hope this helps,
>> Steve C. Orr, MCSD, MVP
>> http://SteveOrr.net
>>
>>
>> "Rudy" <Rudy@.discussions.microsoft.com> wrote in message
>> news:B76F371F-B5A7-42F4-BCAD-56FF560D8A99@.microsoft.com...
>> > Hello all!
>>> > I basicly know how to pull a image down with using Image source in
>> > HTML.
>> > By
>> > telling image src what file name to open. But if I have the file path
>> > stored
>> > in a SQL database. such as c:/mypictures/myimagefile.gif, how would I
>> > call
>> > that back up, to show that file with out typing the path in my code.
>> > Can
>> > I
>> > just refrence the sql server, and read that file path? What would be
>> > the
>> > correct way of writing that in my code. Or am I totally off base, and
>> > do
>> > this an entirely diffrent way.
>>> > TIA!!!
>>> > Rudy
>>
>>
>

newbie issue - asp.net file displays as source

Hi,

I just setup the .NET framework for asp.net. I have programmed regular
csharp and ado.net programs before. I use the Borland CSharpBuilder IDE

I am having a problem that must have a simple solution.- any aspx file I
create within the IDE and then Run, opens as source in Internet Explorer.
The same file, say one of the quickstart examples run from the quickstart
page opens as expected in rendered html.

What am I doing wrong?

TIA
aacoolThere's a readme file that comes with the Resource Kit. Here's a snippet on installing ASP.NET

2) Install ASP.NET - > From a command prompt window, run the following command from your windows directory: \Microsoft.NET\Framework\version\aspnet_regiis -i
Where version is the version number of the .NET Framework is installed on your machine (v1.1.4322, for example).

Note with Windows Server 2003, you can install ASP.NET using the Add or Remove Programs Control Panel.

Hope this helps...
"=?Utf-8?B?UmljaGllQQ==?=" <anonymous@.discussions.microsoft.com> wrote
in news:79616F35-16F1-4E07-AA4C-41BE37FD10E7@.microsoft.com:

> There's a readme file that comes with the Resource Kit. Here's a
> snippet on installing ASP.NET:
> 2) Install ASP.NET - > From a command prompt window, run the following
> command from your windows directory:
> \Microsoft.NET\Framework\version\aspnet_regiis -i Where version is the
> version number of the .NET Framework is installed on your machine
> (v1.1.4322, for example).
> Note with Windows Server 2003, you can install ASP.NET using the Add
> or Remove Programs Control Panel.
> Hope this helps...

Thanks for your response - it sounded right - I followed it, and the
additional step mentioned in msdn of registering the aspnet_isapi dll -
regsvr32 %windir%\Microsoft.NET\Framework\v1.1.4322\aspnet_ isapi.dll

This has not helped - I still see only the source code and am unable to see
the rendered html correctly.

Please advise
aacool
you need to type this at the command prompt

\Microsoft.NET\Framework\version\aspnet_regiis -i
^^^^^^^^
and then hit Enter. I've installed it on a couple of machines this way. Give it a try if you haven't as yet

Good luck..

2) Install ASP.NET - > From a command prompt window, run the followin
> command from your windows directory
> \Microsoft.NET\Framework\version\aspnet_regiis -i Where version is th
> version number of the .NET Framework is installed on your machin
> (v1.1.4322, for example).
"=?Utf-8?B?UmljaGllQQ==?=" <anonymous@.discussions.microsoft.com> wrote
in news:968CBAD1-E3FC-45F6-AFD6-B47FE4A97AD9@.microsoft.com:

> you need to type this at the command prompt :
> \Microsoft.NET\Framework\version\aspnet_regiis -i
> ^^^^^^^^^
> and then hit Enter. I've installed it on a couple of machines this
> way. Give it a try if you haven't as yet.
> Good luck...
> 2) Install ASP.NET - > From a command prompt window, run the
> following
>> command from your windows directory:
>> \Microsoft.NET\Framework\version\aspnet_regiis -i Where version is
>> the version number of the .NET Framework is installed on your machine
>> (v1.1.4322, for example).

TY - I did exactly that, but the problem remains

aacool

Friday, March 16, 2012

Newbie needs a tutorial on reading and writing to nodes in an XML file

I have an ASP.NET app that I am writing using VB.NET and I want to use an
XML file to store configuration settings in sort of like the way I used to
use an .INI file for in Windows apps. When the user opens a page, it needs
to go read certain settings out of the file and fill textboxes and other
form fields with the data from the XML file. If the user makes any changes
on the form, it needs to write back to the XML file to store the new
settings.

Any help with this would be greatly appreciated!you will find everything here
http://msdn.microsoft.com/library/d...Msxslscript.asp

Av.
"David Hearn" <david.hearn@.stagparkway.com> wrote in message
news:%23YQ4ynpXEHA.2940@.TK2MSFTNGP09.phx.gbl...
>I have an ASP.NET app that I am writing using VB.NET and I want to use an
>XML file to store configuration settings in sort of like the way I used to
>use an .INI file for in Windows apps. When the user opens a page, it needs
>to go read certain settings out of the file and fill textboxes and other
>form fields with the data from the XML file. If the user makes any changes
>on the form, it needs to write back to the XML file to store the new
>settings.
> Any help with this would be greatly appreciated!

Newbie needs a tutorial on reading and writing to nodes in an XML file

I have an ASP.NET app that I am writing using VB.NET and I want to use an
XML file to store configuration settings in sort of like the way I used to
use an .INI file for in Windows apps. When the user opens a page, it needs
to go read certain settings out of the file and fill textboxes and other
form fields with the data from the XML file. If the user makes any changes
on the form, it needs to write back to the XML file to store the new
settings.
Any help with this would be greatly appreciated!you will find everything here
http://msdn.microsoft.com/library/d...ript
.asp
Av.
"David Hearn" <david.hearn@.stagparkway.com> wrote in message
news:%23YQ4ynpXEHA.2940@.TK2MSFTNGP09.phx.gbl...
>I have an ASP.NET app that I am writing using VB.NET and I want to use an
>XML file to store configuration settings in sort of like the way I used to
>use an .INI file for in Windows apps. When the user opens a page, it needs
>to go read certain settings out of the file and fill textboxes and other
>form fields with the data from the XML file. If the user makes any changes
>on the form, it needs to write back to the XML file to store the new
>settings.
> Any help with this would be greatly appreciated!
>

Newbie needs help with user controls

I created a menu that I want on every page and saved it as a .ascx file. It works on my web site, but when I'm testing scripts on my local machine using IIS, the menu will not show up.

I do not get an error or anything, but was hoping someone could point me in the right direction. Is there a setting in IIS or WebMatrix that is causing the menu not to show up and I need to change?

Thanx in advance!Can u post your code please.
Menu.ascx
===================================================

<%@. Control Language="VB" %>
Members | Sign
Up | News | Forums | Mobile | Tutorials | Resources | Support | Search
===================================================

Default.aspx
===================================================

<%@. Page Language="VB" Debug="true" %>
<%@. Register TagPrefix="dotnet" TagName="mnDotnet" src="http://pics.10026.com/?src=Menu.ascx" %>
<html>
<head>
<title>Yourdotnet.com</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="http://links.10026.com/?link=css/dotnet.css" type="text/css" rel="stylesheet" />
</head>
<body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0">
<!-- Start Main table -->
<table cellspacing="0" cellpadding="0" width="760" border="0">
<tbody>
<tr>
<td>
<!-- Begin Header table -->
<table cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
<tr>
<td class="text3" valign="center" background="images/bg_grey3D.gif" widht="625">
<!-- Begin User Control for the menu -->
<dotnet:mnDotnet id="mnDotnet" runat="server"></dotnet:mnDotnet>
</td>
<td valign="center" align="right" width="135" background="images/bg_grey3D.gif">
<img src="http://pics.10026.com/?src=images/logo_dotnet.gif" width="135" border="0" /></td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
</tbody>
</table>
<!-- End Header table --></td>
</tr>
<tr>
<td valign="top">
<!-- Start Main Content table -->
<table cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
<tr>
<td class="border" valign="top" align="middle" width="180">
<br />
<!-- Start Web Hosting Etc Banner -->
<hr width="100%" color="#c5c5c5" noshade="noshade" size="1" />
<img src="http://pics.10026.com/?src=http://www.webhostingetc.net/ads/renderbanners/smallsquare.jpg" border="0" />
<hr width="100%" color="#c5c5c5" noshade="noshade" size="1" />
<img alt="Powered by ASP.NET" src="http://pics.10026.com/?src=images/logo_aspdotnet.gif" border="0" />
<br />
<br />
</td>
<td class="border">
<table cellpadding="4" align="center" border="0">
<tbody>
<tr>
<td align="middle">
</td>
</tr>
<tr>
<td>
<p align="center">
<b class="headline">This site is under construction...Please check back soon!</b>
</p>
<br />
<form runat="server">
</form>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<!-- End Main Content table --></td>
</tr>
<tr>
<td align="middle">

</td>
</tr>
</tbody>
</table>
<!-- End Main table -->
</body>
</html>
====================================================

Thanks midi25
Theres alot of code there my brother and looks in need of a clean up. I suspect and this has happened to me a few times that the html comments or a faulty <tag> somewhere may be giving you a problem and not causing the control to be displayed. Apart from that the rest of the .net code looks ok. Also make sure that default.aspx and menu.ascx are both in your root folder in IIS.
Thanx for the reply. I think you might have found the problem since I have the 2 files in a folder, named 'dotnet' which is a folder in the root directory of my IIS. The only reason I put them there was because I was planning on developing an intranet for my home network and assumed that I could not have both in the IIS root folder.

This leads me to my next question (and then I'll stop bothering you). If I do develop an intranet and put the 2 forementioned files in the root folder, how will users get to each site since they will both have a default.aspx file in the same directory?

Do I need to:

1. assign each site its own server port OR

2. just create the intranet and put the 'dotnet' directory as a sub-directory in that? If so, won't I encounter the same problem, because I will then need 2 menu.ascx files, 1 for the intranet and for dotnet site?
Note: the intranet site will be something completely different than the dotnet site, which is merely for testing scripts before uploading them to my web host, so I really do not want to keep them in the same directory.

Last question:

Could you please recommend a good .NET web host(s)?