|
hi all
i am deploying an asp.net application and i want to prevent users from seeing my connection string. I want to hide my user name and password. I googled a little but there is no clear example that i found. I only found theories. Any help with some code, url.. any thing that closes the encryption idea or what ever called to me.
thanks in advance.
|
|
|
|
|
Hi,
Use the following code to encrypt and decrypt your connection string.
public static byte[] Encrypt(byte[] clearData, byte[] Key, byte[] IV)
{
//create the memory stream
MemoryStream ms = new MemoryStream();
//create a crypto service provider
Rijndael objrj = Rijndael.Create();
//set the Key and iV values
objrj.Key = Key;
objrj.IV = IV;
//create a crypto ctream
CryptoStream cs = new CryptoStream(ms,objrj.CreateEncryptor(),CryptoStreamMode.Write);
cs.Write(clearData,0,clearData.Length);
cs.Close();
byte[] encryptedData = ms.ToArray();
return encryptedData;
}
public static byte[] Decrypt(byte[] cypherData, byte[] Key, byte[] IV)
{
//create the memory stream
MemoryStream ms = new MemoryStream();
//create a crypto service provider
Rijndael objrj = Rijndael.Create();
//set the Key and iV values
objrj.Key = Key;
objrj.IV = IV;
//create a crypto ctream
CryptoStream cs = new CryptoStream(ms,objrj.CreateDecryptor(),CryptoStreamMode.Write);
cs.Write(cypherData,0,cypherData.Length);
cs.Close();
byte[] clearData = ms.ToArray();
return clearData;
}
|
|
|
|
|
Dear All,
I wish to maintain the scroll position on postback. In .NET Framework 2.0, there
is a Page Element "MaintainScrollPositiononPostBack".
But Now I am using ASP.NET 1.1, there I heard about the Page element
"SmartNavigation". I have set it as TRUE.
<%@ Page SmartNavigation="true" language="c#" AutoEventWireup="false" %>
BUT its not works for me. Any one can help me pls?
Regards,
Jay
|
|
|
|
|
Verify in Design Mode the Same Property in Form Properties Window.
|
|
|
|
|
Hi,
Yes, I have checked in Property window (for DOCUMENT), in that also
"smartNavigation=true" only.
Regards,
Jay
|
|
|
|
|
There are issues with SmartNavigation. You could always look at CrossBrowser SmartNavigation[^]
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Dear Friends,
Could you please help me in this regard. What I need is this,
1. I want a .net User Interface to display office files(word, excel etc.).
So that I can put it in my web page to display office files. Similar to
DSO Framer control, but DSO Framer control is an activeX control made by using un-managed code.
But I need a similar UI, made by using .Net Framework. Doesnt itlook good. Could you please help me in this regard.
Thank you.
S/W Engineer
Akebono Soft Technologies
aleem_abdul@akebonosoft.com.
|
|
|
|
|
|
indian143 wrote: Doesnt itlook good.
It would, but I'd say that after you asking over and over, over several days, that it probably doesn't exist.
Have you commited to a project that you have no idea how to do ? I can't imagine why else you keep asking for something that doesn't exist, instead of doing something productive towards reaching your goal.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Whats your Idea about sync fusion. And one more thing could you please advise me, how should I build UI. And
1. shall I build my UI for already existing product like aspose or syncfusion.
2. Can I build an UI using .Net framework. If so, please advise me how can I do it. If possible give me some code snippet too.
3. Otherwise please advise me some thing else too. Please.
S/W Engineer
Akebono Soft Technologies
aleem_abdul@akebonosoft.com.
|
|
|
|
|
How i can hide/invisible ASP.net page. I need to do some background processing on click of some url. User should not be able to know that....I can not find any hide or invisible property for page
Amit
|
|
|
|
|
You can't hide a persons browser, so there's no property like that. What do you need to do, and what were you hoping to have happen ? Once you feed a page, there is no such thing as 'background', you could be doing something, but you can't let the browser know about it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Go the URL you like to go, do the process and then redirect to the original page... Done...
|
|
|
|
|
Thats great venkatesh, I really appreciate your answers. You have given ans to me even for many times. Thanks a lot, I wanted to give you this appreciation. Most of the times your ans will be true. Thanks for your dedication. Hats off.
S/W Engineer
Akebono Soft Technologies
aleem_abdul@akebonosoft.com.
|
|
|
|
|
|
Thanks for your reply. But i don't want to redirect to any other page. My requirement is as below
a) User will get email to his personal email id with one url which contains some querystring parm.
b) If user click on above url, then i want to do some operation e.g. best example is like we get emails from different registered site to inactivate my account.
Please suggest....
Amit
|
|
|
|
|
Do you want to close the window or hide the page? Hiding the page is not possible...
But we can close the window.
Use window.close() in the Page's OnLoad Event. Don't think closing the window will stop your process, because Server Script executes first and then only Client Script executes...
|
|
|
|
|
Sir,
Can I have a .Net made control(like UI) to display and edit the word and excel files. Its functionalities must be similar to DSO Framer control, but it should be prepared by using .Net framework or a .Net control. Please tell me if you have any Idea. Please.
S/W Engineer
Akebono Soft Technologies
aleem_abdul@akebonosoft.com.
|
|
|
|
|
Hey guys, I'm doing something similar to the example below (c# version):
http://samples.gotdotnet.com/quickstart/util/srcview.aspx?path=/quickstart/aspplus/samples/apps/cookies1/cookies1.src&file=CS\Cookies1.aspx&font=3[^]
Basically this sample has two different pages (cookies.aspx and customize.aspx). I'm implementing it in one page (i.e. when user click the right choices from the drop down lists, and click subit button, it should apply those properties and change the color, font size etc. Well when I first run the page (ctrl+F5). And the very first time that I select the properties from the lists, they get applied properly. Then if I go back to the drop down and change, lets say the color and text and hit submit again... it doesnt get applied and it needs the button clicked twice (i.e except for the intial request when it works on one click, you need the button to be clicked twice).
So it sounds like the initial GET request is working but when you submit (that is post back) that’s when its not behaving as expected.
Can someone please help...PLEASE NOTE in the original sample that you can run from here( http://samples.gotdotnet.com/quickstart/aspplus/samples/apps/cookies1/VB/cookies1.aspx[^]) above that there are two pages and that could be causing this behaviour since I only have one page but I just can't see where or how ????
Thanks for all your help
Tina
|
|
|
|
|
Sounds like you're setting some properties in your page load handler. This is fired before your event, so the event is changing a property, but the property has already been used until you click again. Two things to do here
1 - use the page prerender event for stuff that occurs after an event
2 - always set break points and debug your code to see what's happening when you have a problem.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi Christian, I am new to software development and still learning the debugging techniques and stuff, but I did set up break points at page load and the handler for my click event, but can’t quite figure out why is it happening. The weird thing is that after going through the button click event’s code, control doesn’t return back to the browser window like it normally should and colors and stuff should change. Anyways I see your first point, could you please help me a little bit more as to what exactly I should be doing in the pre-render event. I haven’t used that one yet. And how?? I would appreciate any help I could get!
Thanks
Tina
|
|
|
|
|
Sure
Basically in .NET 2.0, the methods hook themselves up, any prior version, you need to hook it up. Your load event is being hooked up in code in a region, just add a hook to prerender. In 2.0, just put a
protected void Page_PreRender(object sender, EventArgs ea)
method in your code. The critical thing is, this is called AFTER the events, and is the place to put stuff that changes how the site looks, such as setting colors, or filling lists with data. I've not seen your code, so I am guessing, but I do know that your page load will be called before your events, so any changes to the site that happen in the event, unless they are done directly to controls, may not do what you hope. That is, if your event sets a private variable that stores the color, and your page load uses that variable to color some controls, the variable gets changed AFTER it is used. Using that variable in the prerender, uses it AFTER the event.
Again, I am guessing. I could give better help if I saw your code.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Hi Christian, yup when you told me in your response prior to this one, that I should try the PreRender method, I did that. And I did go into the designer generated code and explicitly wired the event handler for the pre render event (this.PreRender+=new System.EventHandler(this.Page_PreRender)).
Then I copied the same code that I have in my load event handler into Page_PreRender event handler. i.e.
<br />
public void Page_PreRender(object sender, System.EventArgs e)<br />
{<br />
if (!IsPostBack)<br />
{<br />
HttpCookie cookie = Response.Cookies["preferences1"];<br />
ViewState["Referer"] = Request.Headers["Referer"];<br />
<br />
if ( cookie != null )<br />
{<br />
BackColor.SelectedItem.Value = (string)cookie.Values["BackColor"];<br />
ForeColor.SelectedItem.Value = (string)cookie.Values["ForeColor"];<br />
LinkColor.SelectedItem.Value = (string)cookie.Values["LinkColor"];<br />
FontSize.SelectedItem.Value = (string)cookie.Values["FontSize"];<br />
FontName.SelectedItem.Value = (string)cookie.Values["FontName"];<br />
navControl.SelectedItem.Value = (string) cookie.Values["navControl"];<br />
}<br />
}<br />
userControl.Visible=false;<br />
<br />
}<br />
<br />
public void btnSubmit_Click(object sender, System.EventArgs e)<br />
{<br />
HttpCookie cookie = new HttpCookie("preferences1");<br />
cookie.Values.Add("ForeColor",ForeColor.SelectedItem.Value);<br />
cookie.Values.Add("BackColor",BackColor.SelectedItem.Value);<br />
cookie.Values.Add("LinkColor",LinkColor.SelectedItem.Value);<br />
cookie.Values.Add("FontSize",FontSize.SelectedItem.Value);<br />
cookie.Values.Add("FontName",FontName.SelectedItem.Value);<br />
cookie.Values.Add("navControl", navControl.SelectedItem.Value);<br />
Response.AppendCookie(cookie);<br />
<br />
if(GetStyle("navControl") == "Top")<br />
theControl.Visible = true;<br />
if(GetStyle("navControl") == "Bottom")<br />
This code above is pretty much from the Got dot net sitehttp://samples.gotdotnet.com/quickstart/aspplus/doc/stateoverview.aspx[^].
If you could please take a look at the link above for me...then you would see what I'm going through? Just scroll down to the CLIENT SIDE COOKIES on the link above and click view source. You will see they are doing this whole thing with two different pages (cookies.aspx adn customize.aspx) whereas I'm just using one, If you run the sample from there, you will see what I'm talking about. Also the only difference is that I converted those html select (drop down lists controld they have) into web server controls. I wonder if that has something to do with the problem I'm having since it might be going out to the server for no reason?
Thanks once again for all your help.;)
~TINA
|
|
|
|
|
Tina P wrote: if (!IsPostBack)
This part means your code will never work. By checking this, your code only works the first time the page is opened, and never on a postback. Remove it, or otherwise, have your event handler set the local properties, as well as the cookie. That would make the most sense to me, in a lot of ways.
if (!IsPostback) is used to read settings only the first time a page is opened, and is generally used where an initial state is read, then later changed by the page. For example, on first load, a data driven control would read it's data from the database, but it's both expensive and causes state to be lost, to read it every time. Rather than keep reading hte cookie, it makes more sense to store changes in both the cookie, and the local settings, in the event code. That would also allow you to do this code in the page load ( the pre render problem would have been the issue if the !IsPostback code had not been present )
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Christian, well trust me I've tried alot of things and removing the Page.IsPostBack property was one of them. It still does the same thing (i.e button needs to be cliecked twice).
About your statement below, could you please show me (by perhaps some sample code how to do that)
<quote>
"Rather than keep reading hte cookie, it makes more sense to store changes in both the cookie, and the local settings, in the event code."
Also did you look at the code from the link I sent you prior to this message...that's very similar to what I have. And any thought on making those web server controls into html controls as I mentioned in the pervious post??
Thanks
~Tina
|
|
|
|
|