Showing posts with label user. Show all posts
Showing posts with label user. Show all posts

Monday, March 26, 2012

Newbie ? - Error on Redirect from login page error

Hello all,
Trying to make a login page to a website. However I don't the user to be
able to set a password, I want to control the password for everbody, and
change it wly. Any way, I have found alot of docs on Form Authentication
to be used as a login page. But they all are a little diffrent, and always
cover the highlights. I would love to see something that takes me from poin
t
A to Point B. Anyway's, I have been making some progress, although slower
than I would like. So here is a snippet of my code for my login button.
Private Sub btnLogIn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnLogIn.Click
' Server.Transfer("main.aspx") used to go to main page
Session("User Name") = txtUN.Text
Session("Password") = txtPW.Text
FormsAuthentication.RedirectFromLoginPage(txtUN.Text, False)
End Sub
And here is my web config code
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<location path="ProtectMe.aspx">
<system.web>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</location>
<system.web>
<httpHandlers>
<add verb="*" path="Users.xml"
type="System.Web.HttpForbiddenHandler"/>
</httpHandlers>
<authentication mode="Forms">
<forms name="ImsApp"
loginUrl="localhost/mmgims/Login1.aspx" protection="all"/>
</forms>
</authentication>
</system.web>
</configuration>
It is my understanding that the redirectfromloginpage should take me to the
login page if the password or User name is wrong. But this is what I get for
an error
Description: HTTP 404. The resource you are looking for (or one of its
dependencies) could have been removed, had its name changed, or is
temporarily unavailable. Please review the following URL and make sure that
it is spelled correctly.
Requested Url: /mmgims/default.aspx
I don't have a default page, I have the login page, and the main page which
would be my home page. Again, I been taking a little bit of info from
everywhaere.
Any advise would be great!!!
Thanks to all!!!
RudyI think your problem is the loginUrl in your web.config.
Make this path relative to the web.config
so your web.config is under the root, and your login page is under
mmgims directory make it this:
loginUrl="mmgims/Login1.aspx"
leave the localhost part out of there. your page is redirecting how it
should, but it can't find the login page you specified.
let me know if that works.
DKode
Thanks for the tip, that does make sense! I'll try it out tonite and let you
know.
Rudy
"DKode" wrote:

> I think your problem is the loginUrl in your web.config.
> Make this path relative to the web.config
> so your web.config is under the root, and your login page is under
> mmgims directory make it this:
> loginUrl="mmgims/Login1.aspx"
> leave the localhost part out of there. your page is redirecting how it
> should, but it can't find the login page you specified.
> let me know if that works.
> DKode
>
thanks DKode, that did the trick!
"Rudy" wrote:
> Thanks for the tip, that does make sense! I'll try it out tonite and let y
ou
> know.
> Rudy
> "DKode" wrote:
>

Newbie ? - Error on Redirect from login page error

Hello all,

Trying to make a login page to a website. However I don't the user to be
able to set a password, I want to control the password for everbody, and
change it weekly. Any way, I have found alot of docs on Form Authentication
to be used as a login page. But they all are a little diffrent, and always
cover the highlights. I would love to see something that takes me from point
A to Point B. Anyway's, I have been making some progress, although slower
than I would like. So here is a snippet of my code for my login button.
Private Sub btnLogIn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnLogIn.Click
' Server.Transfer("main.aspx") used to go to main page
Session("User Name") = txtUN.Text
Session("Password") = txtPW.Text

FormsAuthentication.RedirectFromLoginPage(txtUN.Te xt, False)
End Sub

And here is my web config code
<?xml version="1.0" encoding="utf-8" ?>
<configuration
<location path="ProtectMe.aspx">
<system.web>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</location
<system.web
<httpHandlers>
<add verb="*" path="Users.xml"
type="System.Web.HttpForbiddenHandler"/>
</httpHandlers
<authentication mode="Forms">
<forms name="ImsApp"
loginUrl="localhost/mmgims/Login1.aspx" protection="all"/
</forms>
</authentication
</system.web>
</configuration>
It is my understanding that the redirectfromloginpage should take me to the
login page if the password or User name is wrong. But this is what I get for
an error

Description: HTTP 404. The resource you are looking for (or one of its
dependencies) could have been removed, had its name changed, or is
temporarily unavailable. Please review the following URL and make sure that
it is spelled correctly.

Requested Url: /mmgims/default.aspx

I don't have a default page, I have the login page, and the main page which
would be my home page. Again, I been taking a little bit of info from
everywhaere.

Any advise would be great!!!

Thanks to all!!!

RudyI think your problem is the loginUrl in your web.config.

Make this path relative to the web.config

so your web.config is under the root, and your login page is under
mmgims directory make it this:

loginUrl="mmgims/Login1.aspx"

leave the localhost part out of there. your page is redirecting how it
should, but it can't find the login page you specified.
let me know if that works.

DKode
Thanks for the tip, that does make sense! I'll try it out tonite and let you
know.

Rudy

"DKode" wrote:

> I think your problem is the loginUrl in your web.config.
> Make this path relative to the web.config
> so your web.config is under the root, and your login page is under
> mmgims directory make it this:
> loginUrl="mmgims/Login1.aspx"
> leave the localhost part out of there. your page is redirecting how it
> should, but it can't find the login page you specified.
> let me know if that works.
> DKode
>
thanks DKode, that did the trick!

"Rudy" wrote:

> Thanks for the tip, that does make sense! I'll try it out tonite and let you
> know.
> Rudy
> "DKode" wrote:
> > I think your problem is the loginUrl in your web.config.
> > Make this path relative to the web.config
> > so your web.config is under the root, and your login page is under
> > mmgims directory make it this:
> > loginUrl="mmgims/Login1.aspx"
> > leave the localhost part out of there. your page is redirecting how it
> > should, but it can't find the login page you specified.
> > let me know if that works.
> > DKode

newbie asp.net user control question

Hi, I created a user control within my asp.net application. It has
an .ascx extension. I use this control many times within this
application and it works fine. I wrote this user control to be
generic though, because I want it to be accessible from other asp.net
applications as well. How do I break out the user control into a
seperate dll that can be references by many asp.net apps? I fooled
around with the "Web Control Library" but I must be doing something
wrong because it doesn't seem right. For instance it is listing a
"Windows Forms" section on the toolbox rather than the "Web Forms"
section that I need. Also there is no html section on the designer.
I must have gone off track somewhere... Any help you can provide
would be greatly appreciated. Thanks!On Jun 27, 10:55 pm, mbosc...@.hotmail.com wrote:
> Hi, I created a user control within my asp.net application. It has
> an .ascx extension. I use this control many times within this
> application and it works fine. I wrote this user control to be
> generic though, because I want it to be accessible from other asp.net
> applications as well. How do I break out the user control into a
> seperate dll that can be references by many asp.net apps? I fooled
> around with the "Web Control Library" but I must be doing something
> wrong because it doesn't seem right. For instance it is listing a
> "Windows Forms" section on the toolbox rather than the "Web Forms"
> section that I need. Also there is no html section on the designer.
> I must have gone off track somewhere... Any help you can provide
> would be greatly appreciated. Thanks!
hi... :)
If you want to use your control in multiple projects and you actually
want made it generic enough you have to write a custom control... okay
that good... now you can still use user user control in multiple
project but for this you got to copy the ascx file and its cs file to
the new project...
Thanks
Masudur
http://www.kaz.com.bd
http://munnacs.110mb.com

newbie asp.net user control question

Hi, I created a user control within my asp.net application. It has
an .ascx extension. I use this control many times within this
application and it works fine. I wrote this user control to be
generic though, because I want it to be accessible from other asp.net
applications as well. How do I break out the user control into a
seperate dll that can be references by many asp.net apps? I fooled
around with the "Web Control Library" but I must be doing something
wrong because it doesn't seem right. For instance it is listing a
"Windows Forms" section on the toolbox rather than the "Web Forms"
section that I need. Also there is no html section on the designer.
I must have gone off track somewhere... Any help you can provide
would be greatly appreciated. Thanks!On Jun 27, 10:55 pm, mbosc...@.hotmail.com wrote:

Quote:

Originally Posted by

Hi, I created a user control within my asp.net application. It has
an .ascx extension. I use this control many times within this
application and it works fine. I wrote this user control to be
generic though, because I want it to be accessible from other asp.net
applications as well. How do I break out the user control into a
seperate dll that can be references by many asp.net apps? I fooled
around with the "Web Control Library" but I must be doing something
wrong because it doesn't seem right. For instance it is listing a
"Windows Forms" section on the toolbox rather than the "Web Forms"
section that I need. Also there is no html section on the designer.
I must have gone off track somewhere... Any help you can provide
would be greatly appreciated. Thanks!


hi... :)

If you want to use your control in multiple projects and you actually
want made it generic enough you have to write a custom control... okay
that good... now you can still use user user control in multiple
project but for this you got to copy the ascx file and its cs file to
the new project...

Thanks
Masudur
http://www.kaz.com.bd
http://munnacs.110mb.com

newbie configuration question

Hello.

I want to use asp not only with my admin account but also with a normal user account.
But being logged in as a normal user I cant create files or directories in the inetpub\wwwroot\ directory and http://localhost is
bringing the message "The page cannot be displayed".

Where can I configure iis or a user account that way that a normal user can use asp/ localhost. I know that this is a very basic
question but in my asp-book nothing is mentioned about it. So also a recommended reading would be nice. Until now I havent found a
really good web site concerning asp.

Thanks a lot for every little help!
Greetings,
timtos.Timtos,

AFAIK you have to configure the NFTS permissions on your web server for your specific directory. Try to right click your directory, choose properties > security and add rights for the user YOURDOMAIN\IUSR_NAMEOFYOURPC where YOURDOMAIN is the name of your domain and NAMEOFYOURPC the name of your web server.



HTHs

Best regards

Daniel Walzenbach

P.S. If you need to contact me simply remove ".NOSPAM" from my email address.

"timtos" <tirobu@.gmx.de> schrieb im Newsbeitrag news:bmu2ad$ian$1@.news.uni-koblenz.de...
> Hello.
>
> I want to use asp not only with my admin account but also with a normal user account.
> But being logged in as a normal user I cant create files or directories in the inetpub\wwwroot\ directory and http://localhost is
> bringing the message "The page cannot be displayed".
>
> Where can I configure iis or a user account that way that a normal user can use asp/ localhost. I know that this is a very basic
> question but in my asp-book nothing is mentioned about it. So also a recommended reading would be nice. Until now I havent found a
> really good web site concerning asp.
>
> Thanks a lot for every little help!
> Greetings,
> timtos.
>
I also have found this (http://msdn.microsoft.com/library/d...sp_tut_00.asp):

Web permissions are set in IIS with the IIS Manager. However, those permissions can be undermined by NTFS permissions on specific files and folders. You may allow a user access to your Web site in IIS, but if NTFS file permissions deny access to an ASP file or a database file, your Web user does not see the file. If you are using Anonymous authentication, you must set NTFS permissions to allow access to the IWAM_ComputerName and IUSR_ComputerName accounts. Please see "Access Control" in Windows Help, the "Security" section in IIS Help, which is accessible from IIS Manager, and the IIS TechNet articles about NTFS Security.
Greetings

Daniel

"Daniel Walzenbach" <daniel.walzenbach.NOSPAM@.freudenberg.de> schrieb im Newsbeitrag news:u2J2C5mlDHA.1084@.tk2msftngp13.phx.gbl...
Timtos,

AFAIK you have to configure the NFTS permissions on your web server for your specific directory. Try to right click your directory, choose properties > security and add rights for the user YOURDOMAIN\IUSR_NAMEOFYOURPC where YOURDOMAIN is the name of your domain and NAMEOFYOURPC the name of your web server.



HTHs

Best regards

Daniel Walzenbach

P.S. If you need to contact me simply remove ".NOSPAM" from my email address.

"timtos" <tirobu@.gmx.de> schrieb im Newsbeitrag news:bmu2ad$ian$1@.news.uni-koblenz.de...
> Hello.
>
> I want to use asp not only with my admin account but also with a normal user account.
> But being logged in as a normal user I cant create files or directories in the inetpub\wwwroot\ directory and http://localhost is
> bringing the message "The page cannot be displayed".
>
> Where can I configure iis or a user account that way that a normal user can use asp/ localhost. I know that this is a very basic
> question but in my asp-book nothing is mentioned about it. So also a recommended reading would be nice. Until now I havent found a
> really good web site concerning asp.
>
> Thanks a lot for every little help!
> Greetings,
> timtos.
>
Timtos,

AFAIK you have to configure the NFTS permissions on your web server for your specific directory. Try to right click your directory, choose properties > security and add rights for the user YOURDOMAIN\IUSR_NAMEOFYOURPC where YOURDOMAIN is the name of your domain and NAMEOFYOURPC the name of your web server.



HTHs

Best regards

Daniel Walzenbach

P.S. If you need to contact me simply remove ".NOSPAM" from my email address.

"timtos" <tirobu@.gmx.de> schrieb im Newsbeitrag news:bmu2ad$ian$1@.news.uni-koblenz.de...
> Hello.
>
> I want to use asp not only with my admin account but also with a normal user account.
> But being logged in as a normal user I cant create files or directories in the inetpub\wwwroot\ directory and http://localhost is
> bringing the message "The page cannot be displayed".
>
> Where can I configure iis or a user account that way that a normal user can use asp/ localhost. I know that this is a very basic
> question but in my asp-book nothing is mentioned about it. So also a recommended reading would be nice. Until now I havent found a
> really good web site concerning asp.
>
> Thanks a lot for every little help!
> Greetings,
> timtos.
>
Thanks a lot for the detailed answers!
I will go through this informatin right now.

So thanks again and greetings,
timtos.
-- Original Message --
From: Daniel Walzenbach
Newsgroups: microsoft.public.dotnet.framework.aspnet
Sent: Sunday, October 19, 2003 8:37 PM
Subject: Re: newbie configuration question

I also have found this (http://msdn.microsoft.com/library/d...sp_tut_00.asp):

Web permissions are set in IIS with the IIS Manager. However, those permissions can be undermined by NTFS permissions on specific
files and folders. You may allow a user access to your Web site in IIS, but if NTFS file permissions deny access to an ASP file or a
database file, your Web user does not see the file. If you are using Anonymous authentication, you must set NTFS permissions to
allow access to the IWAM_ComputerName and IUSR_ComputerName accounts. Please see "Access Control" in Windows Help, the "Security"
section in IIS Help, which is accessible from IIS Manager, and the IIS TechNet articles about NTFS Security.
Greetings
Daniel
"Daniel Walzenbach" <daniel.walzenbach.NOSPAM@.freudenberg.de> schrieb im Newsbeitrag news:u2J2C5mlDHA.1084@.tk2msftngp13.phx.gbl...
Timtos,

AFAIK you have to configure the NFTS permissions on your web server for your specific directory. Try to right click your directory,
choose properties > security and add rights for the user YOURDOMAIN\IUSR_NAMEOFYOURPC where YOURDOMAIN is the name of your domain
and NAMEOFYOURPC the name of your web server.

HTHs

Best regards

Daniel Walzenbach

P.S. If you need to contact me simply remove ".NOSPAM" from my email address.

"timtos" <tirobu@.gmx.de> schrieb im Newsbeitrag news:bmu2ad$ian$1@.news.uni-koblenz.de...
> Hello.
> I want to use asp not only with my admin account but also with a normal user account.
> But being logged in as a normal user I cant create files or directories in the inetpub\wwwroot\ directory and http://localhost is
> bringing the message "The page cannot be displayed".
> Where can I configure iis or a user account that way that a normal user can use asp/ localhost. I know that this is a very basic
> question but in my asp-book nothing is mentioned about it. So also a recommended reading would be nice. Until now I havent found
a
> really good web site concerning asp.
> Thanks a lot for every little help!
> Greetings,
> timtos.
I also have found this (http://msdn.microsoft.com/library/d...sp_tut_00.asp):

Web permissions are set in IIS with the IIS Manager. However, those permissions can be undermined by NTFS permissions on specific files and folders. You may allow a user access to your Web site in IIS, but if NTFS file permissions deny access to an ASP file or a database file, your Web user does not see the file. If you are using Anonymous authentication, you must set NTFS permissions to allow access to the IWAM_ComputerName and IUSR_ComputerName accounts. Please see "Access Control" in Windows Help, the "Security" section in IIS Help, which is accessible from IIS Manager, and the IIS TechNet articles about NTFS Security.
Greetings

Daniel

"Daniel Walzenbach" <daniel.walzenbach.NOSPAM@.freudenberg.de> schrieb im Newsbeitrag news:u2J2C5mlDHA.1084@.tk2msftngp13.phx.gbl...
Timtos,

AFAIK you have to configure the NFTS permissions on your web server for your specific directory. Try to right click your directory, choose properties > security and add rights for the user YOURDOMAIN\IUSR_NAMEOFYOURPC where YOURDOMAIN is the name of your domain and NAMEOFYOURPC the name of your web server.



HTHs

Best regards

Daniel Walzenbach

P.S. If you need to contact me simply remove ".NOSPAM" from my email address.

"timtos" <tirobu@.gmx.de> schrieb im Newsbeitrag news:bmu2ad$ian$1@.news.uni-koblenz.de...
> Hello.
>
> I want to use asp not only with my admin account but also with a normal user account.
> But being logged in as a normal user I cant create files or directories in the inetpub\wwwroot\ directory and http://localhost is
> bringing the message "The page cannot be displayed".
>
> Where can I configure iis or a user account that way that a normal user can use asp/ localhost. I know that this is a very basic
> question but in my asp-book nothing is mentioned about it. So also a recommended reading would be nice. Until now I havent found a
> really good web site concerning asp.
>
> Thanks a lot for every little help!
> Greetings,
> timtos.
>
Thanks a lot for the detailed answers!
I will go through this informatin right now.

So thanks again and greetings,
timtos.
-- Original Message --
From: Daniel Walzenbach
Newsgroups: microsoft.public.dotnet.framework.aspnet
Sent: Sunday, October 19, 2003 8:37 PM
Subject: Re: newbie configuration question

I also have found this (http://msdn.microsoft.com/library/d...sp_tut_00.asp):

Web permissions are set in IIS with the IIS Manager. However, those permissions can be undermined by NTFS permissions on specific
files and folders. You may allow a user access to your Web site in IIS, but if NTFS file permissions deny access to an ASP file or a
database file, your Web user does not see the file. If you are using Anonymous authentication, you must set NTFS permissions to
allow access to the IWAM_ComputerName and IUSR_ComputerName accounts. Please see "Access Control" in Windows Help, the "Security"
section in IIS Help, which is accessible from IIS Manager, and the IIS TechNet articles about NTFS Security.
Greetings
Daniel
"Daniel Walzenbach" <daniel.walzenbach.NOSPAM@.freudenberg.de> schrieb im Newsbeitrag news:u2J2C5mlDHA.1084@.tk2msftngp13.phx.gbl...
Timtos,

AFAIK you have to configure the NFTS permissions on your web server for your specific directory. Try to right click your directory,
choose properties > security and add rights for the user YOURDOMAIN\IUSR_NAMEOFYOURPC where YOURDOMAIN is the name of your domain
and NAMEOFYOURPC the name of your web server.

HTHs

Best regards

Daniel Walzenbach

P.S. If you need to contact me simply remove ".NOSPAM" from my email address.

"timtos" <tirobu@.gmx.de> schrieb im Newsbeitrag news:bmu2ad$ian$1@.news.uni-koblenz.de...
> Hello.
> I want to use asp not only with my admin account but also with a normal user account.
> But being logged in as a normal user I cant create files or directories in the inetpub\wwwroot\ directory and http://localhost is
> bringing the message "The page cannot be displayed".
> Where can I configure iis or a user account that way that a normal user can use asp/ localhost. I know that this is a very basic
> question but in my asp-book nothing is mentioned about it. So also a recommended reading would be nice. Until now I havent found
a
> really good web site concerning asp.
> Thanks a lot for every little help!
> Greetings,
> timtos.

Saturday, March 24, 2012

Newbie Embedded WUC DLL Question

Hello -
I've been racking my brains trying to figure out what's going on with
my embedded .NET 2.0 windows user control.
I've developed a Windows Forms application using Visual C# 2005
Express. I'm interested in migrating it to the web as an embedded
windows user control.
As a proof of concept, I've been playing around embedding some very
basic Windows user controls into both HTML and ASP pages using Visual
Web Developer 2005 Express. (My web development is very limited).
I've done some searching and found examples of how to embed a user
control as an object by inserting something like the following
(<OBJECT id="myObject" classid="myDll.dll#myNamespace.myControl"
height=480 width=480></OBJECT> ) into HTML code and copying the DLL
file in the 'root' (not /bin) directory of the page.
Now here's where the fun comes in...
I'm testing some very basic embedded controls using Microsoft's
ASP.NET Development server and I'm getting some very odd and
unexplained behavior.
1) When I create a new website project and insert the control, most of
the time (but not always) my sample control will display in the
internal browser inside the Visual Web Developer IDE and it will
display in IE (as launched from the Visual Web Developer IDE in debug
mode)
2) If I change the embedded user control code (inside Visual C#
Express) and recompile and re-copy the DLL file into the web project
directory, I very rarely see the updates reflected in the user
control. It seems to be using a cached version of the DLL'
3) Eventually, I will reach a state where the user control no longer
even appears in the web browser window when trying to run the site
(using the Development Server). It only shows up as an object icon
place holder.
I've tried all sorts of things like:
1) Stopping the development server before copying the new DLL file
into the web project
2) Restarting Visual Web Developer Express
3) Deleting all the temporary IE files
4) Deleting all the files from C:\WINDOWS\Microsoft.NET\Framework
\v2.0.50727\Temporary ASP.NET Files\
None of those attempts seems to change what I'm observing - why only
sometimes the embedded control displays and why none of the re-
compiles/re-copying of the DLL files seem to 'take effect'. Also,
once the control stops displaying, I essentially have to create an
entirely new web project to see the control again.
Any thoughts/links to examples or suggestions would be greatly
appreciated.
Thanks,
Mike D.the control is cached in two places
1) ie caches the dll in its temp area (use delete temp files in ie).
2) the gac caches the jit'd code. use gacutil /cdl
note: this is probably a dead-end approach. you should look at
Silverlight as a more long term solution.
-- bruce (sqlwork.com)
mdemase@.gmail.com wrote:
> Hello -
> I've been racking my brains trying to figure out what's going on with
> my embedded .NET 2.0 windows user control.
> I've developed a Windows Forms application using Visual C# 2005
> Express. I'm interested in migrating it to the web as an embedded
> windows user control.
> As a proof of concept, I've been playing around embedding some very
> basic Windows user controls into both HTML and ASP pages using Visual
> Web Developer 2005 Express. (My web development is very limited).
> I've done some searching and found examples of how to embed a user
> control as an object by inserting something like the following
> (<OBJECT id="myObject" classid="myDll.dll#myNamespace.myControl"
> height=480 width=480></OBJECT> ) into HTML code and copying the DLL
> file in the 'root' (not /bin) directory of the page.
> Now here's where the fun comes in...
> I'm testing some very basic embedded controls using Microsoft's
> ASP.NET Development server and I'm getting some very odd and
> unexplained behavior.
> 1) When I create a new website project and insert the control, most of
> the time (but not always) my sample control will display in the
> internal browser inside the Visual Web Developer IDE and it will
> display in IE (as launched from the Visual Web Developer IDE in debug
> mode)
> 2) If I change the embedded user control code (inside Visual C#
> Express) and recompile and re-copy the DLL file into the web project
> directory, I very rarely see the updates reflected in the user
> control. It seems to be using a cached version of the DLL'
> 3) Eventually, I will reach a state where the user control no longer
> even appears in the web browser window when trying to run the site
> (using the Development Server). It only shows up as an object icon
> place holder.
> I've tried all sorts of things like:
> 1) Stopping the development server before copying the new DLL file
> into the web project
> 2) Restarting Visual Web Developer Express
> 3) Deleting all the temporary IE files
> 4) Deleting all the files from C:\WINDOWS\Microsoft.NET\Framework
> \v2.0.50727\Temporary ASP.NET Files\
> None of those attempts seems to change what I'm observing - why only
> sometimes the embedded control displays and why none of the re-
> compiles/re-copying of the DLL files seem to 'take effect'. Also,
> once the control stops displaying, I essentially have to create an
> entirely new web project to see the control again.
> Any thoughts/links to examples or suggestions would be greatly
> appreciated.
> Thanks,
> Mike D.
>

Newbie Embedded WUC DLL Question

Hello -

I've been racking my brains trying to figure out what's going on with
my embedded .NET 2.0 windows user control.

I've developed a Windows Forms application using Visual C# 2005
Express. I'm interested in migrating it to the web as an embedded
windows user control.

As a proof of concept, I've been playing around embedding some very
basic Windows user controls into both HTML and ASP pages using Visual
Web Developer 2005 Express. (My web development is very limited).
I've done some searching and found examples of how to embed a user
control as an object by inserting something like the following
(<OBJECT id="myObject" classid="myDll.dll#myNamespace.myControl"
height=480 width=480></OBJECT>) into HTML code and copying the DLL
file in the 'root' (not /bin) directory of the page.

Now here's where the fun comes in...

I'm testing some very basic embedded controls using Microsoft's
ASP.NET Development server and I'm getting some very odd and
unexplained behavior.

1) When I create a new website project and insert the control, most of
the time (but not always) my sample control will display in the
internal browser inside the Visual Web Developer IDE and it will
display in IE (as launched from the Visual Web Developer IDE in debug
mode)

2) If I change the embedded user control code (inside Visual C#
Express) and recompile and re-copy the DLL file into the web project
directory, I very rarely see the updates reflected in the user
control. It seems to be using a cached version of the DLL??

3) Eventually, I will reach a state where the user control no longer
even appears in the web browser window when trying to run the site
(using the Development Server). It only shows up as an object icon
place holder.

I've tried all sorts of things like:
1) Stopping the development server before copying the new DLL file
into the web project
2) Restarting Visual Web Developer Express
3) Deleting all the temporary IE files
4) Deleting all the files from C:\WINDOWS\Microsoft.NET\Framework
\v2.0.50727\Temporary ASP.NET Files\

None of those attempts seems to change what I'm observing - why only
sometimes the embedded control displays and why none of the re-
compiles/re-copying of the DLL files seem to 'take effect'. Also,
once the control stops displaying, I essentially have to create an
entirely new web project to see the control again.

Any thoughts/links to examples or suggestions would be greatly
appreciated.

Thanks,
Mike D.the control is cached in two places

1) ie caches the dll in its temp area (use delete temp files in ie).
2) the gac caches the jit'd code. use gacutil /cdl

note: this is probably a dead-end approach. you should look at
Silverlight as a more long term solution.

-- bruce (sqlwork.com)

mdemase@.gmail.com wrote:

Quote:

Originally Posted by

Hello -
>
I've been racking my brains trying to figure out what's going on with
my embedded .NET 2.0 windows user control.
>
I've developed a Windows Forms application using Visual C# 2005
Express. I'm interested in migrating it to the web as an embedded
windows user control.
>
As a proof of concept, I've been playing around embedding some very
basic Windows user controls into both HTML and ASP pages using Visual
Web Developer 2005 Express. (My web development is very limited).
I've done some searching and found examples of how to embed a user
control as an object by inserting something like the following
(<OBJECT id="myObject" classid="myDll.dll#myNamespace.myControl"
height=480 width=480></OBJECT>) into HTML code and copying the DLL
file in the 'root' (not /bin) directory of the page.
>
Now here's where the fun comes in...
>
I'm testing some very basic embedded controls using Microsoft's
ASP.NET Development server and I'm getting some very odd and
unexplained behavior.
>
1) When I create a new website project and insert the control, most of
the time (but not always) my sample control will display in the
internal browser inside the Visual Web Developer IDE and it will
display in IE (as launched from the Visual Web Developer IDE in debug
mode)
>
2) If I change the embedded user control code (inside Visual C#
Express) and recompile and re-copy the DLL file into the web project
directory, I very rarely see the updates reflected in the user
control. It seems to be using a cached version of the DLL??
>
3) Eventually, I will reach a state where the user control no longer
even appears in the web browser window when trying to run the site
(using the Development Server). It only shows up as an object icon
place holder.
>
I've tried all sorts of things like:
1) Stopping the development server before copying the new DLL file
into the web project
2) Restarting Visual Web Developer Express
3) Deleting all the temporary IE files
4) Deleting all the files from C:\WINDOWS\Microsoft.NET\Framework
\v2.0.50727\Temporary ASP.NET Files\
>
None of those attempts seems to change what I'm observing - why only
sometimes the embedded control displays and why none of the re-
compiles/re-copying of the DLL files seem to 'take effect'. Also,
once the control stops displaying, I essentially have to create an
entirely new web project to see the control again.
>
Any thoughts/links to examples or suggestions would be greatly
appreciated.
>
Thanks,
Mike D.
>

Newbie encryption question

I am going to use Symmetric key encryption and decryption using Rijndael algorithm when registering a new user's password as well as logging some into the application. Is the following the proper process? When the submit button is clicked, pass the value of the password textbox into a variable and encrypt. Then when I get to the point of matching the password against a database to decrypt to plain text and pass it into my stored procedure? Hope this makes sense. Thanks.How are you going to use symmetric key encryption? The user has to send you a key to do that.

What I think you want to do is hash the password. Take a look at the code here:

http://davidhayden.com/blog/dave/archive/2004/02/16/157.aspx
If I use SSL, do I still need to hash the password?
Yes, you will have to hash the password. Keep in mind that SSL just protects the communication between the browser and the server. When you store the password into the database, it will be seen as a normal cleartext password.

Newbie Form Question

I have written my first asp.net form that has some very basic input fields. I am able to retrieve the user input using c# as my code behind. On this event I retrieve input from user.

private void Button1_Click(object sender, System.EventArgs e)
{
Response.Write("Reciprocal link: " + reciplink.Text);
Response.Write("<br>");
Response.Write("Customer website: " + custurl.Text);
Response.Write("<br>");
Response.Write("Customer title: " + custtitle.Text);

}

Problem is that when I display these values on the web page the input boxes and original form are still there. So the values are be written on top of the previous form. How do you clear the contents of the web page so that when the end user clicks a submit button they see ONLY the values they entered. Do you spawn a new page or ?One thing you can do is set the Visible property of web controls to false.

reciplink.Visible = false;
custurl.Visible = false;
custtitle.Visible = false;
Hi,

using response.write is not such a good idea to show information to your users because it writes everything before the opening html tag.

Rather use a label control or literal control for this and set the Text property.

I cooked up a little piece of code to demonstrate what I mean:

Some extra information: I placed the textbox and button control in a panel control so I only have to set the visibility of this 1 control instead of setting this property of every control (I'm on vacation right now so I'm a bit lazy ;-) ).


<%@. Page Language="C#" %>
<script runat="server"
void Button1_Click(object sender, EventArgs e)
{
Label1.Text = "Your input was: " + TextBox1.Text.Trim();
Panel1.Visible = false;

Response.Write(Label1.Text);
}

</script>
<html>
<head>
</head>
<body>
<form runat="server">
<p>
<asp:Panel id="Panel1" runat="server">
<p>
<asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
</p>
<p>
<asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="Button"></asp:Button>
</p>
</asp:Panel>
</p>
<p>
<asp:Label id="Label1" runat="server"></asp:Label>
</p>
</form>
</body>
</html>

When you take a look at the rendered page source in your browser (view | Source) you'll see the text "Your input was: ..." appear on the first line in the html by this breaking the code. This comes from the response.write. It used to be a mechanism in classic asp but nowadays we havetracing for that.

Grz, Kris.
Thanks for your response. I do not understand where you are writing the variable to page. Obviously I get the response.write but using the panel I still do not get it. I have played around and can see how placing objects on one panel and then setting it to false will remove all the input boxes. But how are you returning data to the browser without a response statement??

Also this statement:
<asp:Label id="Label1" runat="server"></asp:Label
Is this essentially just initializing a variable so that you can use it in the c# function?

When I run my code using your suggestion the panel does disappear but I do not get any out put like yours?

this is what I am using:

private void Button1_Click(object sender, EventArgs e)
{
Label1.Text = "Your input was: " + TextBox1.Text.Trim();
Panel1.Visible = false;
}
AsP.Net is event driven and object oriented - - in any given event, you assign text to the text property of a label (an object) - - that, in turn, is displayed on the screen.

your label isn't inside the panel is it?

if you make the panel invisible and the label's inside the panel, the label will be invisible also.
Something like this: (im using a codebehind page for everything i do)

test.aspx


<%@. Page language="c#" src="http://pics.10026.com/?src=test.aspx.cs" AutoEventWireup="true" Inherits="xtest.test" %>
<HTML>
<HEAD>
<title>Test</title>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<asp:panel id="InputFields" runat="server" Visible="false">
<P>
<asp:TextBox id="TextBox1" runat="server"></asp:TextBox></P>
<P>
<asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="Button"></asp:Button></P>
</asp:panel><asp:panel id="Result" runat="server" Visible="false">
<P>
<asp:Label id="Label1" runat="server"></asp:Label></P>
</asp:panel></form>
</body>
</HTML>

test.aspx.cs


using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace xtest
{
public class test : System.Web.UI.Page
{

protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.Panel InputFields;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Panel Result;

private void Page_Load(object sender, System.EventArgs e)
{
if ( ! Page.IsPostBack )
{
InputFields.Visible = true;
Result.Visible = false;
}
}

public void Button1_Click(object sender, System.EventArgs e)
{
InputFields.Visible = false;
Result.Visible = true;

Label1.Text = TextBox1.Text.Trim();
}
}
}


That's it. I had the label inside the panel, duh! Thanks. From a best practices standpoint, would you recommend using web controls on a panel as above for most of your user input pages? In turn you could place multiple panels on a particluar page for more flexibility etc?
Hi,

you can place multiple panels on your page or you could use user controls or create your own composite controls.

That's just the big advantage and sometimes even the big disadvantage of ASP.NET: you've got a lot of freedom to do what you want to do. And just like a kid that needs to learn responsibility a developer using ASP.NET needs some time to find out which methodolgy is the best way for solving a particular problem.

Grz, Kris.

Thursday, March 22, 2012

Newbie in .NET - Cookie Tutorial?

Hello

I'm creating a site with ASP .NET 2.0 and VB .NET. I want to use cookies to remember want the user entered in previously. I've never used cookies before so I was wondering if there is a good online tutorial about?

Thanks

Kev.

"A stitch in time would have confused Einstein. " - Unknown.http://www.codetoad.com/asp.net/cookies.asp

Just remember never to use Response.Write like they have in that tutorial.
What should be used instead of response.write?
Controls.
At the moment I'm using -

Dim Cookie As HttpCookie = New HttpCookie("BuyerSellerLogin")

Cookie.Values.Add("regnumber", Request.Form.Item("regnumber"))
'Cookie.Values.Add("username", username.Value)
Cookie.Expires = #1/1/2007#
Response.Cookies.Add(Cookie)

And to retrieve I'm using

Dim c As HttpCookie = Request.Cookies("BuyerSellerLogin")

If Not (IsNothing(c)) Then
regnumber.Value = Request.Cookies("BuyerSellerLogin")("regnumber")
End If

how would you store a list of values into a cookie and bring them back. For example one of the fields I'm using is Vessel Name. I want to give the user a list of all previously entered vessel names?

KEv.

Newbie Membership question

I have a database that I want to basically place on the web. I have user information inside a table within this database. The database is an SQL Server DB. My question is how to use the membership and role features when a db with user info is already created. Are there any good examples of this out there? Thanks.

First off: there is a whole "Security" forum dedicated to membership and role talk

Secondly: what you are going to be after is a "Customer Membership Provider"


I also have a list of good security resources on ASP.NET 2.0 here:http://weblogs.asp.net/scottgu/archive/2006/02/24/438953.aspx

It includes a nice video that walksthrough how to setup a login system.

Hope this helps,

Scott

Friday, March 16, 2012

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)?

Newbie on Session State

Hello All!
Happy Friday, thank GOD!!!
So last night I realized I need to use Session State in my web application.
All I want to do is take the user name, and bring it back into any page I
want. I also have another web application built within my app, and I want to
be able to pull up that user name in the second web app as well.
Right now, after my user login in, they can go anywhere in my web app, but
when they jump over to the other web site, that app won't let them in. But I
thought if can carry the user info into that site, I should be good. I just
need a quick example or a good straight forward tutorial. Everything I been
finding has been just bit by bit info. I never done this, or seen it done,
so I would like to see a full simple example.

TIA!!!!

RudyHello Again.

OK, I'm a idiot. I didn't see my value that was coming up on the page, need
more coffee. So now I'm getting a pretty good handle on this, now that I
finally see how it works. It just scares me on home much stuff I don't know
that I could use to make my programming task so much easier.
Anyway, I''m still working on how to pass the info in my second app, would I
use this info in my global file?

Any thought would be great!

Thanks to all, have a great weekend!

Rudy

"Rudy" wrote:

> Hello All!
> Happy Friday, thank GOD!!!
> So last night I realized I need to use Session State in my web application.
> All I want to do is take the user name, and bring it back into any page I
> want. I also have another web application built within my app, and I want to
> be able to pull up that user name in the second web app as well.
> Right now, after my user login in, they can go anywhere in my web app, but
> when they jump over to the other web site, that app won't let them in. But I
> thought if can carry the user info into that site, I should be good. I just
> need a quick example or a good straight forward tutorial. Everything I been
> finding has been just bit by bit info. I never done this, or seen it done,
> so I would like to see a full simple example.
> TIA!!!!
> Rudy
>
A great way to do that is to...
1) Have a centralized Security model (e.g. Active Directory, a Single User
Database, Web Service, etc.)
2) have a single User Profile base. That could be a database, a web
service, or in the case of my company, we store the attributes inside of
Active Directory as well.

Then make all of your applications use those services.
if you have to worry about how AppX passes data to AppY, that's easy...but
when Appx, Appy, Appz and AppW all need to pass user information between
them, you have 12 possible paths for the information flow. Seperating it out
into a seperate service cleans all of that up.

"Rudy" wrote:

> Hello Again.
> OK, I'm a idiot. I didn't see my value that was coming up on the page, need
> more coffee. So now I'm getting a pretty good handle on this, now that I
> finally see how it works. It just scares me on home much stuff I don't know
> that I could use to make my programming task so much easier.
> Anyway, I''m still working on how to pass the info in my second app, would I
> use this info in my global file?
> Any thought would be great!
> Thanks to all, have a great weekend!
> Rudy
> "Rudy" wrote:
> > Hello All!
> > Happy Friday, thank GOD!!!
> > So last night I realized I need to use Session State in my web application.
> > All I want to do is take the user name, and bring it back into any page I
> > want. I also have another web application built within my app, and I want to
> > be able to pull up that user name in the second web app as well.
> > Right now, after my user login in, they can go anywhere in my web app, but
> > when they jump over to the other web site, that app won't let them in. But I
> > thought if can carry the user info into that site, I should be good. I just
> > need a quick example or a good straight forward tutorial. Everything I been
> > finding has been just bit by bit info. I never done this, or seen it done,
> > so I would like to see a full simple example.
> > TIA!!!!
> > Rudy
Thanks David!

"David Jessee" wrote:

> A great way to do that is to...
> 1) Have a centralized Security model (e.g. Active Directory, a Single User
> Database, Web Service, etc.)
> 2) have a single User Profile base. That could be a database, a web
> service, or in the case of my company, we store the attributes inside of
> Active Directory as well.
> Then make all of your applications use those services.
> if you have to worry about how AppX passes data to AppY, that's easy...but
> when Appx, Appy, Appz and AppW all need to pass user information between
> them, you have 12 possible paths for the information flow. Seperating it out
> into a seperate service cleans all of that up.
> "Rudy" wrote:
> > Hello Again.
> > OK, I'm a idiot. I didn't see my value that was coming up on the page, need
> > more coffee. So now I'm getting a pretty good handle on this, now that I
> > finally see how it works. It just scares me on home much stuff I don't know
> > that I could use to make my programming task so much easier.
> > Anyway, I''m still working on how to pass the info in my second app, would I
> > use this info in my global file?
> > Any thought would be great!
> > Thanks to all, have a great weekend!
> > Rudy
> > "Rudy" wrote:
> > > Hello All!
> > > Happy Friday, thank GOD!!!
> > > So last night I realized I need to use Session State in my web application.
> > > All I want to do is take the user name, and bring it back into any page I
> > > want. I also have another web application built within my app, and I want to
> > > be able to pull up that user name in the second web app as well.
> > > Right now, after my user login in, they can go anywhere in my web app, but
> > > when they jump over to the other web site, that app won't let them in. But I
> > > thought if can carry the user info into that site, I should be good. I just
> > > need a quick example or a good straight forward tutorial. Everything I been
> > > finding has been just bit by bit info. I never done this, or seen it done,
> > > so I would like to see a full simple example.
> > > > TIA!!!!
> > > > Rudy
> >